Skins in java

hi readers....
i have a qus if you can solve..i have to make skins in java in swings like winamp is having skins and we can choose one from themm.do help me doing so in java(swings)...
thanx
rohit

Swing has pluggable look and feel (PLAF).

Similar Messages

  • Skins in java swing/gui

    hi!!! i just wanna ask you guys and gals if there is a way for Java GUI to implement a skin, you know, those what we can see in Winamp. That's all. Thanks a lot!!! Have a nice day!!! :-)

    //first make sure you define the image in the class, then override the method
    //defining image
    ImageIcon imageIcon = new ImageIcon("images/background.jpg");
    Image image = imageIcon.getImage();
    //overriding the method that paints the background of the JPanel
    public void paintComponent(Graphics g) {
    super.paintComponent(g); //paint background
    if (image != null) { //there is a picture: draw it
    int height = this.getSize().height;
    int width = this.getSize().width;
    g.drawImage(image,0,0, width, height, this);
    //g.drawImage(image, 0, 0, this); //original image size
    } //end if
    } //end paint

  • Charging and the annoying lights, skins, and java apps...

    So, as you all may know... When you plug in this phone to charge it, the rave-ready lights start pulsating away on the sides of the phone. For someone that sleeps with thier phone on the nightstand next to them, this is totaly annoying. I contacted Motorola about this to try to find a way to shut them off (while charging). They said 'No', this is just the way the phone is. My wife is about to throw this thing accross the room at night. If you think the lights aren't bright, try it in pitch black... it blinks the whole room. I don't want to have to put a shirt over something i paid this much for. Anyway, just in case anyone else wondered about that, that was as far as i got.
    So there is a lot that can be done with this phone via bluetooth. I'm just figuring a lot of it out now. Since the base firmware is pretty much a duplicate of the e398 most all java games and applications that worked with that phone work with this one. I fould an older application that works with bluetooth to install free games and applications (finding them on the internet isn't too difficult) with no hassle, totally easy. If anyone wants to know more about that they can email me off the list, becuase i don't know if apple wan't that sort of thing discussed here. Who knows.
    One thing I haven't been able to figure out it how to change the skins. You can do it with a pc pretty easily i think, with the same application that you did it to change skins on the e398. But as a mac user, it's been a little tougher to figure out. When you plug the phone into the computer there are a whole lot of folders in there. I didn't know if i could drop new skins somewhere and they would show up in the skins options. I've tried a couple different folders with new skins to no avail.
    I guess i'll talk more about my regular experiences with the phone later, but i will say, a lot of plusses, and a couple negatives. Take care, and thanks to all

    Saving your marrriage:
    you obviously haven't had a sony-ericsson phone eg se 910- this has green and blue leds that blink all the time and you can't shut it off BUT with the rokr your wife doesn't have to put up with it!
    Ignore motorola support; all you need to do is go Menu, Settings, Ring Styles (Audio on Cingular phones), Event Lights and change to Off. It will no longer flash green when charging, blue when bluetooth activity etc.
    At least that option is on standard rokr - I hope cingular haven't removed that option.

  • Adding designer skin to java application

    can somebody tell me how to add designer well rounded controls to a java appication

    I suppose it is possible that that might require JNI but I suspect, at a minimum, that you should start by asking in the GUI forums first.

  • Java 1.5 skins, GTK, Mac, ect on Windows XP

    Greetings all,
    I had a quick question about some of the newer skins in java. Most of our users run on Windows XP and they wanted to use some of the newer skins in Java. Currently we have Metal, Motif, and Windows to choose from but I wanted to add Mac and GTK and make the Windows 2000 version of the Windows skin available. I had assumed that all skins would be available on all platforms (since they work in Swing and its crossplatform) but when I tried to load the GTK skin on my Windows 2000 dev system it couldn't fin the class "com.sun.java.swing.plaf.gtk.GTKLookAndFeel". Are some skins not included for some platforms? Also from what If read, if you are on Windows XP and you load the Windows skin it looks like Windows XP. Is it postsible to make the skin look like 'classic' windows in XP or the XP skin in Windows 2000?
    Thanks,
    Eudaemon

    It's not called skin, call it LookAndFeel
    you can get the installed look and feel on the system using the javaw.swing.UIanager static methods, but I think they aren't cross-platform, since Windows LookAndFeel uses some libraries into Windows and so on, if they available, so why the method getInsalledLookAndFeel() doesn't return them? maybe I'm right or maybe there is a way to install a LookAndFeel independently!
    Regards
    Mohammed Saleem

  • Mouse events ignored in custom skin

    I created a custom skin for my spinner. While I managed to get the layout this time, it seems that all mouse click events are ignored.
    package ch.sahits.game.javafx.control.skin;
    import java.io.InputStream;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.ObservableList;
    import javafx.event.EventHandler;
    import javafx.geometry.Dimension2D;
    import javafx.scene.Group;
    import javafx.scene.control.TextField;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.HBox;
    import javafx.scene.layout.VBox;
    import ch.sahits.game.javafx.control.OpenPatricianSpinner;
    import ch.sahits.game.javafx.control.TextSizingUtility;
    import com.sun.javafx.scene.control.skin.SkinBase;
    public class OpenPatricianSpinnerSkin extends
            SkinBase<OpenPatricianSpinner, OpenPatricianSpinnerBehavior> {
        private TextSizingUtility sizing = new TextSizingUtility();
        public OpenPatricianSpinnerSkin(final OpenPatricianSpinner spinner) {
            super(spinner, new OpenPatricianSpinnerBehavior(spinner));
            Dimension2D dim4heigth = sizing.calculate(1, spinner.getFont());
            double width = 0;
            for (String word : spinner.getOptions()) {
                Dimension2D dim4width = sizing.calculate(word, spinner.getFont());
                if (dim4width.getWidth() > width) {
                    width = dim4width.getWidth();
            Dimension2D dim = new Dimension2D(width, dim4heigth.getHeight());
            String firstValue = "";
            if (!spinner.getOptions().isEmpty()) {
                firstValue = spinner.getOptions().get(0);
                spinner.selectedIndexProperty().set(0);
            HBox hbox = new HBox();
            final TextField textField = new TextField(firstValue);
            textField.getStyleClass().add("openPatricianSpinner");
            textField.setMaxSize(dim.getWidth(), dim.getHeight());
            textField.setEditable(false);
            InputStream is = getClass().getResourceAsStream("SlabUp.png");
            Image img = new Image(is);
            double imgWidth = img.getWidth();
            final ImageView imgViewUp = new ImageView(img);
            is = getClass().getResourceAsStream("SlabDown.png");
            img = new Image(is);
            final ImageView imgViewDown = new ImageView(img);
            double additionalWidth = Math.max(img.getWidth(), imgWidth);
            is = getClass().getResourceAsStream("InputPlank.jpg");
            img = new Image(is,dim.getWidth()+additionalWidth, dim.getHeight(), false, true);
            final ImageView imgViewPlank = new ImageView(img);
            imgViewPlank.onMouseReleasedProperty().addListener(new ChangeListener<EventHandler<? super MouseEvent>>(){
                @Override
                public void changed(ObservableValue<? extends EventHandler<? super MouseEvent>> ov,
                        EventHandler<? super MouseEvent> oldValue,
                        EventHandler<? super MouseEvent> newValue) {
                    System.out.println("Clicked on plank");
            Group textGroup = new Group(textField);
            VBox vbox = new VBox();
            vbox.getChildren().addAll(imgViewUp, imgViewDown);
            hbox.getChildren().addAll(textGroup, vbox);
            Group background = new Group(imgViewPlank,hbox);
            imgViewUp.onMouseReleasedProperty().addListener(new ChangeListener<EventHandler<? super MouseEvent>>(){
                @Override
                public void changed(ObservableValue<? extends EventHandler<? super MouseEvent>> ov,
                        EventHandler<? super MouseEvent> oldValue,
                        EventHandler<? super MouseEvent> newValue) {
                    ObservableList<String> options = spinner.getOptions();
    System.out.println("Clicked on slabUp");
                    if (!options.isEmpty()) {
                        if (spinner.getSelectedIndex() > 0) {
                            spinner.selectedIndexProperty().subtract(1);
                            String newDisplayValue = options.get(spinner.getSelectedIndex());
                            textField.setText(newDisplayValue);
                        } else {
                            System.out.println("Selected index <= 0");
                    } else {
                        System.out.println("Empty options list");
            }); // end up change listener
            imgViewDown.onMouseReleasedProperty().addListener(new ChangeListener<EventHandler<? super MouseEvent>>(){
                @Override
                public void changed(ObservableValue<? extends EventHandler<? super MouseEvent>> ov,
                        EventHandler<? super MouseEvent> oldValue,
                        EventHandler<? super MouseEvent> newValue) {
                    ObservableList<String> options = spinner.getOptions();
    System.out.println("Clicked on slabDown");
                    if (!options.isEmpty()) {
                        if (spinner.getSelectedIndex() < options.size()) {
                            spinner.selectedIndexProperty().add(1);
                            String newDisplayValue = options.get(spinner.getSelectedIndex());
                            textField.setText(newDisplayValue);
                        } else {
                            System.out.println("Selected index >= options.length");
                    } else {
                        System.out.println("Empty options list");
            }); // end up change listener
            onMouseReleasedProperty().addListener(new ChangeListener<EventHandler<? super MouseEvent>>(){
                @Override
                public void changed(ObservableValue<? extends EventHandler<? super MouseEvent>> ov,
                        EventHandler<? super MouseEvent> oldValue,
                        EventHandler<? super MouseEvent> newValue) {
                    System.out.println("Clicked on Skin");
            getChildren().add(background);
    I would at least expect to see the line 134 printed out. I call this spinner from a simple test application, without any event listeners added there.
    Has anyone an idea what might happen here?

    Hello, you don't register an event handler, you register a listener on the event handler property. So you don't listen for clicks, you listen for changing the registered click handler. You need to register the handler like this:
    imgViewDown.setOnMouseReleased(new EventHandler<MouseEvent>() {
         @Override public void handle(MouseEvent event) {
              // your handler
    This way you set the mouse release event handler which will be called on click. This code, by the way, would fire your listeners (the onMouseReleased property has changed).

  • Skinning; Best Practices & Tools? (Newbie)

    I'm something less than a newbie so I may not be asking this correctly... I am NOT a Java programmer.
    This may be slightly off-topic for this forum, but I think this is the best group for this question.
    I am looking for best practices and tools recommendations for skinning a Java app or game. I need to learn all I can about the steps, tools and potential pitfalls.
    I've got great graphic designers who can make the GUI for me. Now I just need to know my steps for applying it and what I need to watch out for.
    Thanks for any help; links, comments, titles, etc.

    The Skin Look and Feel seems to be designed for desktop applications, and uses KDE and Gnome skins from X. This would be an awkward if not impossible way of skinning a game IMO. I'm interested in any other solutions out there.

  • Unable to change ADF standard text for af_table ("Fetching data...")

    I wish to change the standard "Fetching data..." text displayed by ADF when scrolling through a table.
    Looking at the description in http://jdevadf.oracle.com/adf-richclient-demo/docs/skin-selectors.html, I expect to achieve this by overriding "af_table.LABEL_FETCHING" in my skinning resource bundle.
    I am able to override two af_column messages, but my af_table override does NOT work.
    My bundle looks like this;
    package com.vesterli.demo.skinning;
    import java.util.ListResourceBundle;
    public class MySkinBundle extends ListResourceBundle {
    @Override
    public Object[][] getContents() {
    return _CONTENTS;
    private static final Object[][] _CONTENTS =
    { { "af_table.LABEL_FETCHING", "Hang loose, dude" },
    { "af_column.TIP_SORT_ASCENDING", "First things first" },
    { "af_column.TIP_SORT_DESCENDING", "The last shall be the first" } };
    My trinidad-skins.xml looks like this:
    <?xml version="1.0" encoding="windows-1252" ?>
    <skins xmlns="http://myfaces.apache.org/trinidad/skin">
    <skin>
    <id>vesterli.desktop</id>
    <family>vesterli</family>
    <render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
    <extends>fusion.desktop</extends>
    <style-sheet-name>css/MySkin.css</style-sheet-name>
    <bundle-name>com.vesterli.demo.skinning.MySkinBundle</bundle-name>
    </skin>
    </skins>
    Since I am seeing my customized column tip texts correctly, the reference from trinidad-config.xml to my skin should be OK (I am also seeing my visual skinning correctly). Since I am seeing some of my texts, my resource bundle must be valid, too. I am using JDev 11.1.1.3.
    So why doesn't the af_table skinning work?
    Any pointers appreciated.
    Best regards
    Sten Vesterli

    I was having this problem too, found this thread and did cleanup here and there, redo etc. But ended up with no luck to fix it.
    Just now discovered the issue is reproducible on the official demo site: table Skinning Key Demo
    1. check the column sorting labels, prefixed with "Demo: "
    2. change any selector setting to trigger a table refresh, it's always displayed as "Fetching Data...", without prefix.(as highlighted in the "Resource styles" on the same page, there should be prefix too).

  • Stefankrause XP look and feel

    Hi
    I m posting this thread again. Can anyone show the way to get rid of SecretLoader class in Stefankrause look and feel. SerectLoader Code is not available on net , but this is used in Stefankrause XP look and feel.I have tried default icons but does not exactly serve the purpose.
    I've downloded code from
    http://www.stefan-krause.com/java/
    Or if u've info regarding where is icon file for Microsoft Windows XP on Computer that are used in Java, like icons for plus ,minus, or question mark etc.
    Thanx.

    Hi there, I've used this package and u can use DJ - the java decompiler or jad to decomile it. Or event u can use Gel(a Java IDE written in Java) to just double click the class file to view it's source. Gel can be found at http://www.gexperts.com/.
    note the code
    abyte0[l] ^= 0x2a;
    is what the author exactual encode the resource. u can alse use this method to get the original images, in fact, i've done this, hehe. Since abyte ^ 0x2a ^ 0x2a = abyte, this is just a bitwise operation equals.
    // SecretLoader.java
    // Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: http://kpdus.tripod.com/jad.html
    // Decompiler options: packimports(3)
    package com.stefankrause.xplookandfeel.skin;
    import java.awt.*;
    import java.io.ByteArrayOutputStream;
    import java.io.InputStream;
    import java.net.URL;
    import javax.swing.JPanel;
    public class SecretLoader
    public SecretLoader()
    static Image loadImage(String s)
    URL url;
    url = (com.stefankrause.xplookandfeel.skin.SecretLoader.class).getResource("/com/stefankrause/xplookandfeel/icons/" + s);
    Object obj = null;
    Image image;
    InputStream inputstream = url.openStream();
    ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
    byte abyte0[];
    if(s.endsWith(".res"))
    inputstream.read();
    inputstream.read();
    for(int i = inputstream.read(buffer); i != -1; i = inputstream.read(buffer))
    bytearrayoutputstream.write(buffer, 0, i);
    abyte0 = bytearrayoutputstream.toByteArray();
    for(int l = 0; l < abyte0.length; l++)
    abyte0[l] ^= 0x2a;
    } else
    for(int j = inputstream.read(buffer); j != -1; j = inputstream.read(buffer))
    bytearrayoutputstream.write(buffer, 0, j);
    abyte0 = bytearrayoutputstream.toByteArray();
    int k = inputstream.read(abyte0);
    image = Toolkit.getDefaultToolkit().createImage(abyte0, 0, abyte0.length);
    MediaTracker mediatracker = new MediaTracker(panel);
    mediatracker.addImage(image, 0);
    try
    mediatracker.waitForID(0);
    catch(InterruptedException interruptedexception) { }
    return image;
    Throwable throwable;
    throwable;
    throw new IllegalArgumentException("File " + s + " could not be loaded.");
    static JPanel panel = new JPanel();
    static byte buffer[] = new byte[4096];
    }

  • Is there a default ContextMenu?

    I notice that when I right click on a textarea, I get a menu of standard items. Is this a contextmenu? can I add to this using getContextmenu?
    I ask because I assumed the answer to be yes but get a null ptr exception when I try to add a menu item. I don't want to lose the default menu items, just want to add an item.

    Yes, there is a default context menu for TextInputControls (and a TextArea is a subclass of TextInputControl).
    The default context menu is defined in the TextInputControlSkin.
    http://hg.openjdk.java.net/openjfx/2.2/master/rt/file/tip/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextInputControlSkin.java
    It is weird that you cannot get at the default context menu defined in the skin using the getContextMenu method on TextArea, but that doesn't work, nor does monitoring the contextMenuProperty of the TextArea for changes, as that property always remains null.
    Short of defining a new Skin for TextArea in which you define your own ContextMenu, I don't know how you would modify the ContextMenu contents.
    601     final MenuItem undoMI   = new ContextMenuItem("Undo");
    602     final MenuItem redoMI   = new ContextMenuItem("Redo");
    603     final MenuItem cutMI    = new ContextMenuItem("Cut");
    604     final MenuItem copyMI   = new ContextMenuItem("Copy");
    605     final MenuItem pasteMI  = new ContextMenuItem("Paste");
    606     final MenuItem deleteMI = new ContextMenuItem("DeleteSelection");
    607     final MenuItem selectWordMI = new ContextMenuItem("SelectWord");
    608     final MenuItem selectAllMI = new ContextMenuItem("SelectAll");
    609     final MenuItem separatorMI = new SeparatorMenuItem();
    610
    611     public void populateContextMenu(ContextMenu contextMenu) {
    612         TextInputControl textInputControl = getSkinnable();
    613         boolean editable = textInputControl.isEditable();
    614         boolean hasText = (textInputControl.getLength() > 0);
    615         boolean hasSelection = (textInputControl.getSelection().getLength() > 0);
    616         boolean maskText = (maskText("A") != "A");
    617         ObservableList<MenuItem> items = contextMenu.getItems();
    618
    619         if (isEmbedded()) {
    620             items.clear();
    621             if (!maskText && hasSelection) {
    622                 if (editable) {
    623                     items.add(cutMI);
    624                 }
    625                 items.add(copyMI);
    626             }
    627             if (editable && Clipboard.getSystemClipboard().hasString()) {
    628                 items.add(pasteMI);
    629             }
    630             if (hasText) {
    631                 if (!hasSelection) {
    632                     items.add(selectWordMI);
    633                 }
    634                 items.add(selectAllMI);
    635             }
    636             selectWordMI.getProperties().put("refreshMenu", Boolean.TRUE);
    637             selectAllMI.getProperties().put("refreshMenu", Boolean.TRUE);
    638         } else {
    639             if (editable) {
    640                 items.setAll(undoMI, redoMI, cutMI, copyMI, pasteMI, deleteMI,
    641                              separatorMI, selectAllMI);
    642             } else {
    643                 items.setAll(copyMI, separatorMI, selectAllMI);
    644             }
    645             undoMI.setDisable(!getBehavior().canUndo());
    646             redoMI.setDisable(!getBehavior().canRedo());
    647             cutMI.setDisable(maskText || !hasSelection);
    648             copyMI.setDisable(maskText || !hasSelection);
    649             pasteMI.setDisable(!Clipboard.getSystemClipboard().hasString());
    650             deleteMI.setDisable(!hasSelection);
    651         }
    652     }

  • Possible to replace jscrollpane bar with something else?

    hi,
    is it possible to change the scrollbar in a jscrollpane? i wanted to replace it with an image, is this possible? i just want to change it's look, i've see some skins but not exactly what i wanted, and i'm not sure how to make my own skin. if it's possible can someone tell me how, or point me to a place that shows how to create look and feel skins for java applications?
    Thank you.

    In JScrollPane, the calls setHorizontalScrollBar(JScrollBar horizontalScrollBar) and setVerticalScrollBar(JScrollBar verticalScrollBar) take a JScrollBar as a parameter. This means it would be much easier to use an object that extended JScrollBar.
    Here's a search of the forums for "extends jscrollbar"
    http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%2B%22extends+jscrollbar%22&col=javaforums

  • TreeTable can't change title

    I change TreeTableColumn.text but I got a Exception
    Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: javafx.scene.control.TreeTableColumn cannot be cast to javafx.scene.control.TableColumn
        at com.sun.javafx.scene.control.skin.TableHeaderRow$10.invalidated(TableHeaderRow.java:277)
    so I check TableHeaderRow .
      I find thid method
    private final InvalidationListener columnTextListener = new InvalidationListener() {
            @Override public void invalidated(Observable observable) {
                TableColumn<?,?> column = (TableColumn<?,?>) ((StringProperty)observable).getBean();
                CheckMenuItem menuItem = columnMenuItems.get(column);
                if (menuItem != null) {
                    menuItem.setText(getText(column.getText(), column));
    why don't they use this
    TableColumnBase<?,?> column = (TableColumnBase<?,?>) ((StringProperty)observable).getBean();

    Looks to me that it was a bug which was fixed for a later Java version than whatever it is that you are using.
    See the Java 8u40 source code:
      openjfx/8u40/rt: eb264cdc5828 modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableHeaderRow.java
        private final InvalidationListener columnTextListener = observable -> {
            TableColumnBase<?,?> column = (TableColumnBase<?,?>) ((StringProperty)observable).getBean();
            CheckMenuItem menuItem = columnMenuItems.get(column);
            if (menuItem != null) {
                menuItem.setText(getText(column.getText(), column));
    The source refers to TableColumnBase, not TableColumn.
    Upgrade to use Java 8u40+...

  • How  to chnage the af:tree and  af:treeTable collaspe (+) icon ?

    i need to change the appearance of af:treetable collapse point (+).
    Is this possible ?

    Thanks Ric !!!
    Track Related Links ::
    Re: How to include external style sheet
    Re: How can I customize <af:query> and <af:queryCriteria
    Re: How to reference Scripts and Stylesheet  in Page Template
    include style sheet ::
    http://www.w3.org/TR/REC-CSS1#containment-in-html
    Modify Skin :::
    http://java.sys-con.com/read/273945.htm
    ADF Faces 11g Skins
    Ric's comments in other post
    Here is an article to get you started:
    http://jdj.sys-con.com/read/273945.htm
    This link oulines all of the skinning key:
    http://www.oracle.com/technology/products/adf/adffaces/11/doc/skin-selectors.html
    And here is a thread that outlines how to get started:
    Could not get resource key af_componentX.XXX from skin

  • Help understanding Node.boundsInLocal, Node.boundsInParent?

    Hello all,
    I am reading the JavaFX2 API to understand the getBoundsInLocal() and getBoundsInParent() methods for a Node. I understand the Bounds object that is returned. I would like to better understand the difference between the two methods.
    I read in the API that the getBoundsInLocal() method returns "the rectangular bounds of this Node in the node's untransformed local coordinate space." Am I correct in thinking this is prior to any transformations? So this would be the height, width, x, and y coordinates at initialization?
    The getBoundsInParent() method says "The rectangular bounds of this Node which include its transforms." Does this include transformations?
    My next question is to understand the getBoundsInLocal() method as it is used in this demonstration. Below is an example of creating custom button written by Eric Bruno (http://www.drdobbs.com/blogs/jvm/229400781).
    In the ArrowButtonSkin.java class, Eric is setting the label width and height. When I run the program I see the width value is -1.0 and the height is 0.0. So the control renders as a dot on the screen. Is there a reason the methods below are returning -1 and 0? I am not sure where I went wrong. It works if I explicitly set the values.
    double labelWidth = label.getBoundsInLocal().getWidth();
    double labelHeight = label.getHeight();
    Thank you for assistance.
    Here is the code:
    Driver.java
    * This demo creates a custom Button. See article and explanation at:
    * http://www.drdobbs.com/blogs/jvm/229400781
    package ui.drdobbs;
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.input.MouseEvent;
    import javafx.stage.Stage;
    public class Driver extends Application {
        @Override
        public void start(final Stage stage) {
            stage.setTitle("The JavaFX Bank");
            // Create the node structure for display
            Group rootNode = new Group();
            Button normalBtn = new Button("Close");
            normalBtn.setTranslateX(140);
            normalBtn.setTranslateY(170);
            normalBtn.setOnMouseClicked(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent me) {
                    stage.close();
            // Create a directional arrow button to display account information
            ArrowButton accountBtn = new ArrowButton("Accounts");
            accountBtn.setDirection(ArrowButton.RIGHT);
            accountBtn.setTranslateX(125);
            accountBtn.setTranslateY(10);
            // Handle arrow button press
            accountBtn.setOnMouseClicked(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent me) {
                    System.out.println("Arrow button pressed");
            // Some description text
            Label description = new Label(
                    "Thanks for logging into the\n"
                    + "JavaFX Bank. Click the button\n"
                    + "above to move to the next \n"
                    + "screen, and view your active \n"
                    + "bank accounts.");
            description.setTranslateX(10);
            description.setTranslateY(50);
            rootNode.getChildren().add(accountBtn);
            rootNode.getChildren().add(description);
            rootNode.getChildren().add(normalBtn);
            Scene scene = new Scene(rootNode, 200, 200);
            stage.setScene(scene);
            stage.show();
        public static void main(String[] args) {launch(args);}
    ArrowButton.java
    package ui.drdobbs;
    import javafx.scene.control.Control;
    import javafx.scene.control.Skin;
    import javafx.scene.input.MouseEvent;
    public class ArrowButton extends Control implements ArrowButtonInterface {
        private String title = "";
        public ArrowButton() {
            this.setSkin(new ArrowButtonSkin(this));
        public ArrowButton(String title) {
            this();
            this.title = title;
            ArrowButtonSkin skin = (ArrowButtonSkin)this.getSkin();
            skin.setText(title);
        @Override
        public void setText(String text) {
            getSkin(getSkin()).setText(text);
        @Override
        public void setOnMouseClicked(MouseEvent eh) {
            getSkin(getSkin()).setOnMouseClicked(eh);
        @Override
        public void setDirection(int direction) {
            getSkin(getSkin()).setDirection(direction);
        private ArrowButtonSkin getSkin(Skin skin) {
            return (ArrowButtonSkin)skin;
    ArrowButtonSkin.java
    package ui.drdobbs;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Node;
    import javafx.scene.control.Label;
    import javafx.scene.control.Skin;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.paint.Color;
    import javafx.scene.paint.CycleMethod;
    import javafx.scene.paint.LinearGradient;
    import javafx.scene.paint.Stop;
    import javafx.scene.shape.*;
    public class ArrowButtonSkin implements Skin<ArrowButton>, ArrowButtonInterface {
        //Attributes
        static final double ARROW_TIP_WIDTH = 5;
        ArrowButton control;
        String text = "";
        Group rootNode = new Group();
        Label label = null;
        int direction = ArrowButtonInterface.RIGHT;
        EventHandler clientEH = null;
        //Constructors
        public ArrowButtonSkin(ArrowButton control) {
            this.control = control;
            draw();
        //Methods
        public ArrowButton getControl() {
            return control;
        private void draw() {
            //Create a label.
            if ( label == null )
                label = new Label(text);
            //Set Width Height
            double labelWidth = label.getBoundsInLocal().getWidth();
            double labelHeight = label.getHeight();
            System.out.println(labelWidth + ", " + labelHeight);
            label.setTranslateX(2);
            label.setTranslateY(2);
            // Create arrow button line path elements
            Path path = new Path();
            MoveTo startPoint = new MoveTo();
            double x = 0.0f;
            double y = 0.0f;
            double controlX;
            double controlY;
            double height = labelHeight;
            startPoint.setX(x);
            startPoint.setY(y);
            HLineTo topLine = new HLineTo();
            x += labelWidth;
            topLine.setX(x);
            // Top curve
            controlX = x + ARROW_TIP_WIDTH;
            controlY = y;
            x += 10;
            y = height / 2;
            QuadCurveTo quadCurveTop = new QuadCurveTo();
            quadCurveTop.setX(x);
            quadCurveTop.setY(y);
            quadCurveTop.setControlX(controlX);
            quadCurveTop.setControlY(controlY);
            // Bottom curve
            controlX = x - ARROW_TIP_WIDTH;
            x -= 10;
            y = height;
            controlY = y;
            QuadCurveTo quadCurveBott = new QuadCurveTo();
            quadCurveBott.setX(x);
            quadCurveBott.setY(y);
            quadCurveBott.setControlX(controlX);
            quadCurveBott.setControlY(controlY);
            HLineTo bottomLine = new HLineTo();
            x -= labelWidth;
            bottomLine.setX(x);
            VLineTo endLine = new VLineTo();
            endLine.setY(0);
            path.getElements().add(startPoint);
            path.getElements().add(topLine);
            path.getElements().add(quadCurveTop);
            path.getElements().add(quadCurveBott);
            path.getElements().add(bottomLine);
            path.getElements().add(endLine);
            // Create and set a gradient for the inside of the button
            Stop[] stops = new Stop[] {
                new Stop(0.0, Color.LIGHTGREY),
                new Stop(1.0, Color.SLATEGREY)
            LinearGradient lg =
                new LinearGradient( 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);
            path.setFill(lg);
            rootNode.getChildren().setAll(path, label);
            rootNode.setOnMouseClicked(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent me) {
                    // Pass along to client if an event handler was provided
                    if ( clientEH != null )
                        clientEH.handle(me);
        //Overridden methods from ArrowButtonInterface
         * setText. Method provided by ArrowButtonInterface.
         * @param text
        @Override
        public void setText(String text) {
            this.text = text;
            label.setText(text);
            // update button
            draw();
         * setOnMouseClicked. Method provided by ArrowButtonInterface.
         * @param eh
        public void setOnMouseClicked(EventHandler eh) {
            clientEH = eh;
         * setDirection. Method provided by ArrowButtonInterface.
         * @param direction
        @Override
        public void setDirection(int direction) {
            this.direction = direction;
            // update button
            draw();
        //Overridden methods from Control
        @Override
        public ArrowButton getSkinnable() {
            throw new UnsupportedOperationException("Not supported yet.");
        @Override
        public void setOnMouseClicked(MouseEvent eh) {
            throw new UnsupportedOperationException("Not supported yet.");
        @Override
        public Node getNode() {
            return rootNode;
        @Override
        public void dispose() {
    ArrowButtonInterface
    package ui.drdobbs;
    import javafx.scene.input.MouseEvent;
    public interface ArrowButtonInterface {
        public static final int RIGHT = 1;
        public static final int LEFT = 2;
        public void setText(String text);
        public void setOnMouseClicked(MouseEvent eh);
        public void setDirection(int direction);
    }Edited by: 927562 on Apr 13, 2012 1:28 PM
    Edited by: 927562 on Apr 13, 2012 1:33 PM

    My apology. I didnt realize that was part of the process in forum. Thanks again for the assistance.
    Now that you pointed that out, I see it clearly on the page. Oops.
    Edited by: Gregg on Apr 16, 2012 8:05 PM

  • RoboHelp 9/10 Java Error Trying to Compile AIR Help Skin

    I'm trying to save a custom skin for a RoboHelp 9 project on a Windows 7 64-bit PC using AIR Browser Based Help. When I try to save the skin, or compile it into a SWF, I get the following error:
    Error loading: C:\Program Files\Java\jdk1.7.0_09\jre\bin\jvm.dll
    The dll is located at that path. I tried running RoboHelp as Administrator. I tried editing a new skin with a new clean project and also with a downloaded trial of RoboHelp 10, and I got the same results. Has anyone seen this, or can anyone think of a fix?

    Hello hypericon_0090001,
    Have you found any fix for this, as I am having the same problem.

Maybe you are looking for

  • 13.1.1 retina display canvas issue

    Is anybody else having this problem with retina display macbooks? It seems that the canvas at 100% is displaying more as if it were at 66.7% It is very small, the type in the screenshot is at 12pt, at 200% everything is blurry. the Canvas in the scre

  • Can I clone an intel based iMac to a powerbook G4

    I have an intel iMac (2006) running Tiger, and have just procured a powerbook G4. Is there a way to clone the iMac onto the powerbook. I do;t have much knowledge of the differences between the intel chips and powerpc chips as to whether they cause is

  • Acrobat Pro 9 crashes when OCR more than 50 pages

    Can someone tell me why Acrobat Pro 9 would crash on page 50 of large docs?

  • Measuring areas in Photoshop CS6

    I would like to measure areas on an image.  I use Photoshop CS6.  But when I go to Images/, all the buttons are grayed except for the Ruler Tool.  How can I activate the others?  Do I need Photoshop extended, and if so how do I get it?  Thanks very m

  • MS SQL - Add column with all rows being "0"

    Add column with all rows being "0"