views:

39

answers:

2

Hello. Currently I have a very basic file viewer working as follows :
- in JOptionPane I browse for files, and set some variables to display (colors, line connecting etc)
- previous windows loads a frame with drawn points alt text Code : http://paste.pocoo.org/show/220066/

Now I'd like to throw it into one window, with JMenu for selecting files and changing display parameters. How to get started ? Should I rewrite everything to JDialog ? alt text

+1  A: 

You might also like to look at How to Use Tool Bars and How to Use Menus. Here's a simple example of connecting lines and shapes.

trashgod
+1  A: 

If you want the JOPtionPane as a child of the main JFrame, then add it as a child. Of course it will then cover your dots. Hence you will have to not draw your dots directly in the content pane of the main JFrame, but rather in a new JPanel that you have also added to the JFRame's content pane. Let me know if I've understood the question whatsoever.

Here's some code for how I see the setup (I'm leaving the layout problem out of this, partly because it depends on what you want to see):

    JFrame frame = new JFrame();
    frame.setVisible(true);
    frame.setSize(new Dimension(400,400));
    frame.getContentPane().add(new JOptionPane());
    JPanel canvasForDots = new JPanel();
    frame.getContentPane().add(canvasForDots);
Yar