facebook

need some help…

  1. MyEclipse Archived
  2.  > 
  3. Matisse/Swing UI Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #254054 Reply

    kingzasz
    Member

    I am using matisse to build a GUI for a java app I’m working on. I am new to Java, so I am having some problems.

    I have a few questions, so here I go:

    1) I created a form for my basic GUI, and I put in all my menu items (ex. I have file -> open, file -> properties, etc) Now when I go to work on the JPanel for “file -> properties”, I add it to “other components” instead of creating a new form, correct? Or do I make a form class for everything?

    2) I added a “JFileChooser” to “other components”, and I’ve been trying to link the file -> open to the JFileChooser, so when someone goes file -> open, it opens the file choser dialog box. How would I do that?

    3) I would also like to show only 1 file type, but I can probably figure that out myself…

    Thanks in advance!

    #254105 Reply

    Riyad Kalla
    Member

    1) You will create a new form and it sounds like you probably want a JDialog Form (since it will popup after the person clicks properties)

    2) Right click on your Open menu item, go to Events and add an action -> actionListener event to pop open the dialog. There are visual ways to connect the two using the designer but I usually code the event handlers by hand in this fashion instead.

    3) Try the down arrow in the package explorer and then Filters… I don’t know if it will give you what you want though.

    #254147 Reply

    kingzasz
    Member

    Ok thanks! Got most the stuff figured out.

    I’m still confused with the forms. If I create a different form for everything, every class will have its own main(String args) method. Do I just delete that from all but my main GUI window class?

    I’ve also created an action listener to listen for a menu item to be clicked on, but what code would you use to pop up a JTabbedPane? JFileChooser has methods to open the dialog boxes, but I’m not sure about JTabbedPane. I though setVisible would work, but it didn’t…

    Sorry for all the questions, thanks in advance

    #254148 Reply

    Riyad Kalla
    Member

    I’m still confused with the forms. If I create a different form for everything, every class will have its own main(String args) method. Do I just delete that from all but my main GUI window class?

    Basically, that is just put there so it’s easier for you to test your form by clickng “Run”, you definately only need one.

    I’ve also created an action listener to listen for a menu item to be clicked on, but what code would you use to pop up a JTabbedPane? JFileChooser has methods to open the dialog boxes, but I’m not sure about JTabbedPane. I though setVisible would work, but it didn’t…

    I don’t understand this question really. JTabbedPane is a component, so it has to be added to a top level container before it can be shown (like a JDialog, JWindow, JFrame) or inside of a JPanel that is already inside of a top level container. Maybe explain what you are trying to do and I will see if I can help.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: need some help…

You must be logged in to post in the forum log in