Example usage for javax.swing Box createVerticalBox

List of usage examples for javax.swing Box createVerticalBox

Introduction

In this page you can find the example usage for javax.swing Box createVerticalBox.

Prototype

public static Box createVerticalBox() 

Source Link

Document

Creates a Box that displays its components from top to bottom.

Usage

From source file:de.interactive_instruments.ShapeChange.UI.DefaultDialog.java

private Component createTab1() {

    final JPanel mdlPanel = new JPanel();
    mdlField = new JTextField(40);
    String s = options.parameter("inputFile");
    if (s == null)
        s = "";//w  w  w  .jav a  2 s . co m
    mdlField.setText(s);
    mdlPanel.add(mdlField);
    mdlPanel.add(mdlButton = new JButton("Select File"));
    mdlButton.setActionCommand("MDL");
    mdlButton.addActionListener(this);
    mdlPanel.setBorder(
            new TitledBorder(new LineBorder(Color.black), "Model file", TitledBorder.LEFT, TitledBorder.TOP));

    final JPanel outPanel = new JPanel();
    outField = new JTextField(40);
    s = options.parameter("outputDirectory");
    if (s == null)
        s = ".";
    outField.setText(s);
    outPanel.add(outField);
    outPanel.add(outButton = new JButton("Select File"));
    outButton.setActionCommand("OUT");
    outButton.addActionListener(this);
    outPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Output directory", TitledBorder.LEFT,
            TitledBorder.TOP));

    final JPanel asPanel = new JPanel();
    asField = new JTextField(49);
    s = options.parameter("appSchemaName");
    if (s == null)
        s = "";
    asField.setText(s);
    asPanel.add(asField);
    asPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Application schema name (optional)",
            TitledBorder.LEFT, TitledBorder.TOP));

    final JPanel startPanel = new JPanel();
    startButton = new JButton("Process Model");
    startButton.setActionCommand("START");
    startButton.addActionListener(this);
    startPanel.add(startButton);
    logButton = new JButton("View Log");
    logButton.setActionCommand("LOG");
    logButton.addActionListener(this);
    logButton.setEnabled(false);
    startPanel.add(logButton);
    exitButton = new JButton("Exit");
    exitButton.setActionCommand("EXIT");
    exitButton.addActionListener(this);
    exitButton.setEnabled(true);
    startPanel.add(exitButton);

    Box fileBox = Box.createVerticalBox();
    fileBox.add(mdlPanel);
    fileBox.add(asPanel);
    fileBox.add(outPanel);
    fileBox.add(startPanel);

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(fileBox, BorderLayout.CENTER);

    return panel;
}

From source file:components.FrameDemo2.java

protected JComponent createOptionControls() {
    JLabel label1 = new JLabel("Decoration options for subsequently created frames:");
    ButtonGroup bg1 = new ButtonGroup();
    JLabel label2 = new JLabel("Icon options:");
    ButtonGroup bg2 = new ButtonGroup();

    //Create the buttons
    JRadioButton rb1 = new JRadioButton();
    rb1.setText("Look and feel decorated");
    rb1.setActionCommand(LF_DECORATIONS);
    rb1.addActionListener(this);
    rb1.setSelected(true);//from  w  w w .  ja  v a2 s.  c o m
    bg1.add(rb1);
    //
    JRadioButton rb2 = new JRadioButton();
    rb2.setText("Window system decorated");
    rb2.setActionCommand(WS_DECORATIONS);
    rb2.addActionListener(this);
    bg1.add(rb2);
    //
    JRadioButton rb3 = new JRadioButton();
    rb3.setText("No decorations");
    rb3.setActionCommand(NO_DECORATIONS);
    rb3.addActionListener(this);
    bg1.add(rb3);
    //
    //
    JRadioButton rb4 = new JRadioButton();
    rb4.setText("Default icon");
    rb4.setActionCommand(DEFAULT_ICON);
    rb4.addActionListener(this);
    rb4.setSelected(true);
    bg2.add(rb4);
    //
    JRadioButton rb5 = new JRadioButton();
    rb5.setText("Icon from a JPEG file");
    rb5.setActionCommand(FILE_ICON);
    rb5.addActionListener(this);
    bg2.add(rb5);
    //
    JRadioButton rb6 = new JRadioButton();
    rb6.setText("Painted icon");
    rb6.setActionCommand(PAINT_ICON);
    rb6.addActionListener(this);
    bg2.add(rb6);

    //Add everything to a container.
    Box box = Box.createVerticalBox();
    box.add(label1);
    box.add(Box.createVerticalStrut(5)); //spacer
    box.add(rb1);
    box.add(rb2);
    box.add(rb3);
    //
    box.add(Box.createVerticalStrut(15)); //spacer
    box.add(label2);
    box.add(Box.createVerticalStrut(5)); //spacer
    box.add(rb4);
    box.add(rb5);
    box.add(rb6);

    //Add some breathing room.
    box.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    return box;
}

From source file:gda.gui.mca.McaGUI.java

/**
 * Constructor/*from  w ww .ja va 2  s.  c  om*/
 */
public McaGUI()

{
    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    Box vertBox = Box.createVerticalBox();
    vertBox.add(getTimePanel());
    vertBox.add(getAdcPanel());
    Box horiBox = Box.createHorizontalBox();
    horiBox.add(vertBox);
    horiBox.add(getRoiPanel());
    this.add(getNamePanel());

    this.add(horiBox);
    makePlotPanel();
    this.add(plotPanel);

    Thread plotThread = uk.ac.gda.util.ThreadManager.getThread(new PlotUpdateWorker(),
            "MCA Plot Update thread");
    plotThread.start();

    setLabel("Fluorescence Detector Control");
}

From source file:FrameDemo2.java

protected JComponent createOptionControls() {
    JLabel label1 = new JLabel("Decoration options for subsequently created frames:");
    ButtonGroup bg1 = new ButtonGroup();
    JLabel label2 = new JLabel("Icon options:");
    ButtonGroup bg2 = new ButtonGroup();

    // Create the buttons
    JRadioButton rb1 = new JRadioButton();
    rb1.setText("Look and feel decorated");
    rb1.setActionCommand(LF_DECORATIONS);
    rb1.addActionListener(this);
    rb1.setSelected(true);// ww w  .  java  2 s .co  m
    bg1.add(rb1);
    //
    JRadioButton rb2 = new JRadioButton();
    rb2.setText("Window system decorated");
    rb2.setActionCommand(WS_DECORATIONS);
    rb2.addActionListener(this);
    bg1.add(rb2);
    //
    JRadioButton rb3 = new JRadioButton();
    rb3.setText("No decorations");
    rb3.setActionCommand(NO_DECORATIONS);
    rb3.addActionListener(this);
    bg1.add(rb3);
    //
    //
    JRadioButton rb4 = new JRadioButton();
    rb4.setText("Default icon");
    rb4.setActionCommand(DEFAULT_ICON);
    rb4.addActionListener(this);
    rb4.setSelected(true);
    bg2.add(rb4);
    //
    JRadioButton rb5 = new JRadioButton();
    rb5.setText("Icon from a JPEG file");
    rb5.setActionCommand(FILE_ICON);
    rb5.addActionListener(this);
    bg2.add(rb5);
    //
    JRadioButton rb6 = new JRadioButton();
    rb6.setText("Painted icon");
    rb6.setActionCommand(PAINT_ICON);
    rb6.addActionListener(this);
    bg2.add(rb6);

    // Add everything to a container.
    Box box = Box.createVerticalBox();
    box.add(label1);
    box.add(Box.createVerticalStrut(5)); // spacer
    box.add(rb1);
    box.add(rb2);
    box.add(rb3);
    //
    box.add(Box.createVerticalStrut(15)); // spacer
    box.add(label2);
    box.add(Box.createVerticalStrut(5)); // spacer
    box.add(rb4);
    box.add(rb5);
    box.add(rb6);

    // Add some breathing room.
    box.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    return box;
}

From source file:de.mpg.mpi_inf.bioinf.netanalyzer.ui.ChartDisplayPanel.java

/**
 * Creates and lays out the controls inside this panel.
 * <p>//from  w  w w.  j  a  v a 2s.  c  om
 * This method is called upon initialization only.
 * </p>
 */
private void initControls() {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    add(createChartPanel());

    final Box buttonPanel = Box.createVerticalBox();
    final List<JButton> buttons = new ArrayList<JButton>(8);
    btnEnlarged = Utils.createButton(Messages.DI_VIEWENLARGED, Messages.TT_VIEWENLARGED, this);
    if (Plugin.hasFilter(originalParam.getClass())) {
        btnFilter = Utils.createButton(Messages.DI_FILTERDATA, Messages.TT_FILTERDATA, this);
    } else {
        btnFilter = null;
    }
    btnSaveChart = Utils.createButton(Messages.DI_EXPORTCHART, Messages.TT_SAVECHART, this);
    btnSaveData = Utils.createButton(Messages.DI_EXPORTDATA, Messages.TT_SAVEDATA, this);
    btnChartSettings = Utils.createButton(Messages.DI_CHARTSETTINGS, Messages.TT_CHARTSETTINGS, this);

    buttonPanel.add(btnChartSettings);
    buttons.add(btnChartSettings);
    buttonPanel.add(btnEnlarged);
    buttons.add(btnEnlarged);
    if (btnFilter != null) {
        buttonPanel.add(btnFilter);
        buttons.add(btnFilter);
    }
    buttonPanel.add(Box.createVerticalStrut(Utils.BORDER_SIZE * 2));
    if (decorators != null) {
        btnsDec = new JButton[decorators.length];
        for (int i = 0; i < decorators.length; ++i) {
            Decorator d = decorators[i];
            btnsDec[i] = Utils.createButton(d.getButtonLabel(), d.getButtonToolTip(), this);
            buttonPanel.add(btnsDec[i]);
            buttons.add(btnsDec[i]);
        }
        buttonPanel.add(Box.createVerticalStrut(Utils.BORDER_SIZE * 2));
    }
    buttonPanel.add(btnSaveChart);
    buttons.add(btnSaveChart);
    buttonPanel.add(btnSaveData);
    buttons.add(btnSaveData);
    buttonPanel.add(Box.createVerticalStrut(Utils.BORDER_SIZE * 2));
    buttonPanel.add(Box.createVerticalGlue());
    // Ensure buttons are large enough to fit all possible messages
    final JButton[] btnsArray = new JButton[buttons.size()];
    Utils.setSizes(buttons.toArray(btnsArray), preferred, preferred);
    add(buttonPanel);
    add(Box.createHorizontalGlue());
}

From source file:geovista.network.gui.ClusteringDemo.java

private void setUpView() throws IOException {

    /*// w  w  w. ja v  a  2 s  .  c  o  m
     * Factory<Integer> vertexFactory = new Factory<Integer>() { int n = 0;
     * public Integer create() { return n++; } }; Factory<Number>
     * edgeFactory = new Factory<Number>() { int n = 0; public Number
     * create() { return n++; } };
     */

    /*
     * PajekNetReader<Graph<Integer, Number>, Integer,Number> pnr = new
     * PajekNetReader<Graph<Integer, Number>, Integer,Number>(vertexFactory,
     * edgeFactory);
     * 
     * final Graph<Integer,Number> graph = new SparseMultigraph<Integer,
     * Number>();
     * 
     * pnr.load(br, graph);
     */

    // Create a simple layout frame
    // specify the Fruchterman-Rheingold layout algorithm
    layout = new AggregateLayout<Integer, Number>(new FRLayout<Integer, Number>(g));

    vv = new VisualizationViewer<Integer, Number>(layout);
    vv.setBackground(Color.white);
    // Tell the renderer to use our own customized color rendering
    vv.getRenderContext()
            .setVertexFillPaintTransformer(MapTransformer.<Integer, Paint>getInstance(vertexPaints));
    vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Integer, Paint>() {
        public Paint transform(Integer v) {
            if (vv.getPickedVertexState().isPicked(v)) {
                return Color.blue;
            } else {
                return Color.BLACK;
            }
        }
    });

    vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints));

    vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() {
        protected final Stroke THIN = new BasicStroke(1);
        protected final Stroke THICK = new BasicStroke(2);

        public Stroke transform(Number e) {
            Paint c = edgePaints.get(e);
            if (c == Color.LIGHT_GRAY) {
                return THIN;
            } else {
                return THICK;
            }
        }
    });

    /*
     * //add restart button JButton scramble = new JButton("Restart");
     * scramble.addActionListener(new ActionListener() { public void
     * actionPerformed(ActionEvent arg0) { Layout layout =
     * vv.getGraphLayout(); layout.initialize(); Relaxer relaxer =
     * vv.getModel().getRelaxer(); if(relaxer != null) { relaxer.stop();
     * relaxer.prerelax(); relaxer.relax(); } }
     * 
     * });
     * 
     * DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
     * vv.setGraphMouse(gm);
     */

    final JToggleButton groupVertices = new JToggleButton("Group Clusters");

    // Create slider to adjust the number of edges to remove when clustering
    final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL);
    edgeBetweennessSlider.setBackground(Color.WHITE);
    edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50));
    edgeBetweennessSlider.setPaintTicks(true);
    edgeBetweennessSlider.setMaximum(g.getEdgeCount());
    edgeBetweennessSlider.setMinimum(0);
    edgeBetweennessSlider.setValue(0);
    edgeBetweennessSlider.setMajorTickSpacing(10);
    edgeBetweennessSlider.setPaintLabels(true);
    edgeBetweennessSlider.setPaintTicks(true);

    // edgeBetweennessSlider.setBorder(BorderFactory.createLineBorder(Color.black));
    // TO DO: edgeBetweennessSlider.add(new
    // JLabel("Node Size (PageRank With Priors):"));
    // I also want the slider value to appear
    final JPanel eastControls = new JPanel();
    /*
     * eastControls.setOpaque(true); eastControls.setLayout(new
     * BoxLayout(eastControls, BoxLayout.Y_AXIS));
     * eastControls.add(Box.createVerticalGlue());
     */
    // eastControls.add(edgeBetweennessSlider);

    final Box cluster_panel = Box.createVerticalBox();
    cluster_panel.setBorder(BorderFactory.createTitledBorder("Cluster"));
    cluster_panel.add(edgeBetweennessSlider);

    final String COMMANDSTRING = "Edges removed for clusters: ";
    final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue();

    final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize);
    /*
     * eastControls.setBorder(sliderBorder); //eastControls.add(eastSize);
     * eastControls.add(Box.createVerticalGlue());
     */

    groupVertices.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors,
                    e.getStateChange() == ItemEvent.SELECTED);
            vv.repaint();
        }
    });

    clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected());

    edgeBetweennessSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            JSlider source = (JSlider) e.getSource();
            if (!source.getValueIsAdjusting()) {
                int numEdgesToRemove = source.getValue();
                clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected());
                sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue());
                eastControls.repaint();
                vv.validate();
                vv.repaint();
            }
        }
    });

    cluster_panel.add(groupVertices);
    Container content = getContentPane();
    content.add(new GraphZoomScrollPane(vv));
    JPanel south = new JPanel();
    JPanel grid = new JPanel(new GridLayout(2, 1));
    // grid.add(scramble);
    grid.add(cluster_panel);
    // south.add
    south.add(grid);
    south.add(eastControls);
    JPanel p = new JPanel();
    // p.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    // p.add(gm.getModeComboBox());
    south.add(p);

    content.add(south, BorderLayout.SOUTH);
}

From source file:de.interactive_instruments.ShapeChange.UI.DefaultDialog.java

private JPanel createTab2() {
    final JPanel reportPanel = new JPanel(new GridLayout(3, 1));
    reportGroup = new ButtonGroup();
    String param = options.parameter("reportLevel");
    addRadioButton(reportPanel, reportGroup, "Error", "ERROR", param);
    addRadioButton(reportPanel, reportGroup, "Warning", "WARNING", param);
    addRadioButton(reportPanel, reportGroup, "Info", "INFO", param);
    reportPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Report options", TitledBorder.LEFT,
            TitledBorder.TOP));//ww w  . ja  va2s  .c  o  m

    final JPanel rulePanel = new JPanel(new GridLayout(3, 1));
    ruleGroup = new ButtonGroup();
    param = options.parameter(Options.TargetXmlSchemaClass, "defaultEncodingRule");
    addRadioButton(rulePanel, ruleGroup, "GML 3.2", "iso19136_2007", param);
    addRadioButton(rulePanel, ruleGroup, "GML 3.3", "gml33", param);
    addRadioButton(rulePanel, ruleGroup, "ISO/TS 19139", "iso19139_2007", param);
    addRadioButton(rulePanel, ruleGroup, "GML 3.2 (ShapeChange extensions)",
            "iso19136_2007_ShapeChange_1.0_extensions", param);
    addRadioButton(rulePanel, ruleGroup, "GML 3.3 (INSPIRE extensions)", "iso19136_2007_INSPIRE_Extensions",
            param);
    rulePanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Default encoding rule",
            TitledBorder.LEFT, TitledBorder.TOP));

    final JPanel otherPanel = new JPanel(new GridLayout(2, 1));
    docCB = new JCheckBox("Include documentation", true);
    boolean b = true;
    String s = options.parameter(Options.TargetXmlSchemaClass, "includeDocumentation");
    if (s != null && s.equals("false"))
        b = false;
    docCB.setSelected(b);
    otherPanel.add(docCB);
    visCB = new JCheckBox("Ignore visibility");
    b = true;
    s = options.parameter("publicOnly");
    if (s != null && s.equals("false"))
        b = false;
    visCB.setSelected(!b);
    otherPanel.add(visCB);
    otherPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Other options", TitledBorder.LEFT,
            TitledBorder.TOP));

    Box innerBox = Box.createHorizontalBox();
    innerBox.add(reportPanel);
    innerBox.add(otherPanel);

    Box mainBox = Box.createVerticalBox();
    mainBox.add(innerBox);
    mainBox.add(rulePanel);

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(mainBox, BorderLayout.CENTER);

    return panel;
}

From source file:net.sf.maltcms.chromaui.msviewer.ui.panel.MassSpectrumPanel.java

public void addIdentification() {
    // Create a custom NotifyDescriptor, specify the panel instance as a parameter + other params
    NotifyDescriptor nd = new NotifyDescriptor(ddp, // instance of your panel
            "Select Databases and Settings", // title of the dialog
            NotifyDescriptor.OK_CANCEL_OPTION, // it is Yes/No dialog ...
            NotifyDescriptor.PLAIN_MESSAGE, // ... of a question type => a question mark icon
            null, // we have specified YES_NO_OPTION => can be null, options specified by L&F,
            // otherwise specify options as:
            //     new Object[] { NotifyDescriptor.YES_OPTION, ... etc. },
            NotifyDescriptor.OK_OPTION // default option is "Yes"
    );//from  w  ww .ja  v  a2  s . com
    ddp.updateView();
    // let's display the dialog now...
    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
        if (ddp.getSelectedDatabases().isEmpty()) {
            return;
        }
        Runnable r = new Runnable() {
            @Override
            public void run() {
                IQuery<IScan> query = Lookup.getDefault().lookup(IQueryFactory.class).createQuery(
                        ddp.getSelectedDatabases(), ddp.getRetentionIndexCalculator(),
                        ddp.getSelectedMetabolitePredicate(), ddp.getMatchThreshold(), ddp.getMaxNumberOfHits(),
                        ddp.getRIWindow(), seriesToScan.values().toArray(new IScan[seriesToScan.size()]));
                try {
                    List<QueryResultList<IScan>> results = query.call();
                    Box outerBox = Box.createVerticalBox();
                    for (QueryResultList<IScan> mdqrl : results) {
                        for (IQueryResult<IScan> result : mdqrl) {
                            Box vbox = Box.createVerticalBox();
                            JLabel label = new JLabel("Results for scan " + result.getScan().getScanIndex()
                                    + " at " + result.getScan().getScanAcquisitionTime() + " with ri: "
                                    + result.getRetentionIndex());
                            JLabel dbLabel = new JLabel(
                                    "DB: " + result.getDatabaseDescriptor().getResourceLocation());
                            vbox.add(label);
                            vbox.add(dbLabel);
                            JLabel parameterLabel = new JLabel("Minimum Score: " + ddp.getMatchThreshold()
                                    + "; Maximum #Hits Returned: " + ddp.getMaxNumberOfHits());
                            vbox.add(parameterLabel);
                            DefaultTableModel dlm = new DefaultTableModel(
                                    new String[] { "Score", "RI", "Name", "ID", "MW", "Formula", "Max Mass" },
                                    0);
                            for (IMetabolite metabolite : result.getMetabolites()) {
                                String name = metabolite.getName();
                                if (name.lastIndexOf("_") != -1) {
                                    name = name.substring(name.lastIndexOf("_") + 1);
                                }
                                dlm.addRow(new Object[] { result.getScoreFor(metabolite),
                                        result.getRiFor(metabolite), name, metabolite.getID(),
                                        metabolite.getMW(), metabolite.getFormula(), metabolite.getMaxMass() });
                            }
                            JTable jl = new JTable(dlm);
                            JScrollPane resultScrollPane = new JScrollPane(jl);
                            jl.setAutoCreateRowSorter(true);
                            jl.setUpdateSelectionOnSort(true);
                            vbox.add(resultScrollPane);
                            outerBox.add(vbox);
                            outerBox.add(Box.createVerticalStrut(10));
                        }
                    }
                    JScrollPane jsp = new JScrollPane(outerBox);
                    NotifyDescriptor nd = new NotifyDescriptor(jsp, // instance of your panel
                            "Database Search Results", // title of the dialog
                            NotifyDescriptor.OK_CANCEL_OPTION, // it is Yes/No dialog ...
                            NotifyDescriptor.PLAIN_MESSAGE, // ... of a question type => a question mark icon
                            null, // we have specified YES_NO_OPTION => can be null, options specified by L&F,
                            // otherwise specify options as:
                            //     new Object[] { NotifyDescriptor.YES_OPTION, ... etc. },
                            NotifyDescriptor.OK_OPTION // default option is "Yes"
                    );
                    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
                    }
                    //DBConnectionManager.close();
                } catch (Exception ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
        };
        RequestProcessor.getDefault().post(r);

    }
}

From source file:de.adv_online.aaa.profiltool.ProfilDialog.java

public void initialise(Converter c, Options o, ShapeChangeResult r, String xmi)
        throws ShapeChangeAbortException {

    try {/*from   w  ww .  j  av  a  2s. c o  m*/
        String msg = "Akzeptieren Sie die in der mit diesem Tool ausgelieferten Datei 'Lizenzbedingungen zur Nutzung von Softwareskripten.doc' beschriebenen Lizenzbedingungen?"; // Meldung
        if (msg != null) {
            Object[] options = { "Ja", "Nein" };
            int val = JOptionPane.showOptionDialog(null, msg, "Confirmation", JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.QUESTION_MESSAGE, null, options, options[1]);
            if (val == 1)
                System.exit(0);
        }
    } catch (Exception e) {
        System.out.println("Fehler in Dialog: " + e.toString());
    }

    options = o;

    File eapFile = new File(xmi);
    try {
        eap = eapFile.getCanonicalFile().getAbsolutePath();
    } catch (IOException e) {
        eap = "ERROR.eap";
    }

    converter = new Converter(options, r);
    result = r;
    modelTransformed = false;
    transformationRunning = false;

    StatusBoard.getStatusBoard().registerStatusReader(this);

    // frame
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    // panel
    newContentPane = new JPanel(new BorderLayout());
    newContentPane.setOpaque(true);
    setContentPane(newContentPane);

    newContentPane.add(createMainTab(), BorderLayout.CENTER);

    statusBar = new StatusBar();

    Box fileBox = Box.createVerticalBox();
    fileBox.add(createStartPanel());
    fileBox.add(statusBar);

    newContentPane.add(fileBox, BorderLayout.SOUTH);

    int height = 610;
    int width = 560;

    pack();

    Insets fI = getInsets();
    setSize(width + fI.right + fI.left, height + fI.top + fI.bottom);
    Dimension sD = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation((sD.width - width) / 2, (sD.height - height) / 2);
    this.setMinimumSize(new Dimension(width, height));

    // frame closing
    WindowListener listener = new WindowAdapter() {
        public void windowClosing(WindowEvent w) {
            //JOptionPane.showMessageDialog(null, "Nein", "NO", JOptionPane.ERROR_MESSAGE);
            closeDialog();
        }
    };
    addWindowListener(listener);
}

From source file:com.orange.atk.graphAnalyser.LectureJATKResult.java

/** This method is called from within the constructor to
 * initialize the form.//from   ww w  .  j a v  a2 s. c  om
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
    jListGraph = new JList(listModel);
    jComboBoxLeft = new JComboBox(comboModelLeft);
    jComboBoxRight = new JComboBox(comboModelRight);
    jListMarker = new JList(listModelMarker);
    jTable2 = new javax.swing.JTable();
    jMenu1 = new javax.swing.JMenu();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    jComboBoxLeft.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jComboBoxLeftActionPerformed(evt);
        }
    });

    jComboBoxRight.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jComboBoxRightActionPerformed(evt);
        }
    });

    jTable2.setModel(modeltable);

    jMenu1.setText("File");

    JMenuItem jMenuItem1 = new JMenuItem();
    jMenuItem1.setText("Open Directory");
    jMenuItem1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            openDirectoryAction(evt);
        }
    });

    JMenuItem jMenuItem2 = new JMenuItem();
    jMenuItem2.setText("Add a reference Graph");
    jMenuItem2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            jMenuItemaddGraphActionPerformed(evt);
        }
    });

    JMenuItem jMenuItem3 = new JMenuItem();
    jMenuItem3.setText("set Graph color");
    jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItemChangecolorActionPerformed(evt);
        }
    });

    JMenuItem jMenuItem4 = new JMenuItem();
    jMenuItem4.setText("save config file");
    jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItemSaveConfigFileActionPerformed(evt);
        }
    });
    jMenu1.add(jMenuItem1);
    jMenu1.add(jMenuItem2);
    jMenu1.add(jMenuItem3);
    jMenu1.add(jMenuItem4);

    JMenuBar jMenuBar1 = new JMenuBar();
    jMenuBar1.add(jMenu1);

    setJMenuBar(jMenuBar1);

    //organise JFRAME
    JPanel mainpanel = (JPanel) getContentPane();
    mainpanel.setLayout(new BorderLayout());

    mainpanel.add(chartPanel, BorderLayout.CENTER);

    JPanel toolPanel = new JPanel();
    toolPanel.setLayout(new FlowLayout());

    toolPanel.add(jComboBoxLeft);

    Box graphbox = Box.createVerticalBox();
    graphbox.add(new JLabel("List of Graph "));
    JScrollPane jspaneGraph = new JScrollPane();
    jspaneGraph.setViewportView(jListGraph);
    jspaneGraph.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jspaneGraph.setPreferredSize(new Dimension(150, 100));

    graphbox.add(jspaneGraph);
    //      graphbox.setBorder(BorderFactory.createLineBorder(Color.black));
    toolPanel.add(graphbox);

    Box markerbox = Box.createVerticalBox();
    markerbox.add(new JLabel("List of Marker"));
    JScrollPane jspaneMarker = new JScrollPane();
    jspaneMarker.setViewportView(jListMarker);
    jspaneMarker.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jspaneMarker.setPreferredSize(new Dimension(150, 100));
    markerbox.add(jspaneMarker);
    //      markerbox.setBorder(BorderFactory.createLineBorder(Color.black));
    toolPanel.add(markerbox);

    JScrollPane jspane = new JScrollPane();
    jspane.setViewportView(jTable2);
    jspane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jspane.setPreferredSize(new Dimension(300, 100));
    toolPanel.add(jspane);
    toolPanel.add(jComboBoxRight);

    mainpanel.add(toolPanel, BorderLayout.NORTH);

    pack();
}