Results 1 to 11 of 11
  1. #1
    hornet7288 is offline Member
    Join Date
    Sep 2016
    Posts
    32
    Rep Power
    0

    Default Help with using two combo boxes

    I have to create a program which uses two combo boxes. I have tried multiple times/multiple different ways to create both combo boxes, but the GUI freezes up the moment I go to expand the contents of the second combo box. I have tried just about everything I know how as far as trying different panes, etc. Is there something I am missing here? I do not know jframe so a solution using that won't work. Any help is greatly appreciated!


    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.ComboBox;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;

    public class Exercise extends Application {

    @Override
    public void start(Stage primaryStage) {

    ComboBox<String> cbYear = new ComboBox<>();
    ComboBox<String> cbGender = new ComboBox<>();

    cbYear.getItems().addAll("2001", "2002", "2003", "2004",
    "2005", "2006", "2007", "2008", "2009", "2010");
    cbGender.getItems().addAll("Male", "Female");

    cbYear.setValue("2001");
    cbGender.setValue("Male");

    VBox vbColumn1 = new VBox();
    vbColumn1.getChildren().addAll(cbYear, cbGender);

    Scene scene = new Scene(vbColumn1);

    primaryStage.setTitle("Exercise"); // Set the stage title
    primaryStage.setScene(scene); // Place the scene in the stage
    primaryStage.show(); // Display the stage

    }

    public static void main(String[] args) {
    launch(args);
    }
    }

  2. #2
    hornet7288 is offline Member
    Join Date
    Sep 2016
    Posts
    32
    Rep Power
    0

    Default Re: Help with using two combo boxes

    So I ended up having a buddy run the code and he said it runs just fine on his machine. I currently use netbeans as an IDE. I tried updating, uninstalling/reinstalling and nothing worked. Still crashes when running the simple program above. I even made sure that java was updated on my computer. Wondering if anybody else has had the same issue.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    27

    Default Re: Help with using two combo boxes

    Are these Windows machines of something else?

    I have issues on the Mac running that but it's around missing CSS stuff and a Null Pointer deep inside FX, as well as it being an itty bitty window.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,995
    Rep Power
    9

    Default Re: Help with using two combo boxes

    Runs flawlessly on my Linux machine, Fedora 22, KDE4, Java 1.8.0_92.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  5. #5
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,995
    Rep Power
    9

    Default Re: Help with using two combo boxes

    Try compiling it into a class and run it outside Netbeans.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  6. #6
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: Help with using two combo boxes

    Runs just fine on Windows 10 quad core using Eclipse Mars.2

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  7. #7
    hornet7288 is offline Member
    Join Date
    Sep 2016
    Posts
    32
    Rep Power
    0

    Default Re: Help with using two combo boxes

    It appears after browsing around some that there may be an issue with combo boxes on windows 10 touch screen devices. I am about to upload netbeans to my wife's non touch screen laptop to see if it acts differently. I will post my results.

  8. #8
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    399
    Rep Power
    6

    Default Re: Help with using two combo boxes

    Runs smoothly on my Mac. No error messages.

  9. #9
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: Help with using two combo boxes

    Actually, my Dell laptop is a Windows 10 touch screen. The app worked just fine.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  10. #10
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    399
    Rep Power
    6

    Default Re: Help with using two combo boxes

    check whether you are on 8u101. It was a known issue in the openjdk project for versions earlier than 8u66.

  11. #11
    hornet7288 is offline Member
    Join Date
    Sep 2016
    Posts
    32
    Rep Power
    0

    Default Re: Help with using two combo boxes

    That may possibly be it. It runs fine on my other laptop that is not a touch screen. Thanks for the help!

Similar Threads

  1. Replies: 1
    Last Post: 12-15-2013, 05:19 PM
  2. Combo Boxes HELP
    By nksjolinder1 in forum New To Java
    Replies: 8
    Last Post: 10-25-2011, 05:44 AM
  3. Comparing two combo boxes
    By Wednesday Bass in forum AWT / Swing
    Replies: 2
    Last Post: 03-27-2011, 12:28 PM
  4. multiple combo boxes
    By simo_mon in forum AWT / Swing
    Replies: 1
    Last Post: 07-22-2010, 11:57 AM
  5. [SOLVED] Combo Boxes Automation
    By dbashby in forum New To Java
    Replies: 3
    Last Post: 03-27-2009, 12:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •