Example usage for java.awt Container setLayout

List of usage examples for java.awt Container setLayout

Introduction

In this page you can find the example usage for java.awt Container setLayout.

Prototype

public void setLayout(LayoutManager mgr) 

Source Link

Document

Sets the layout manager for this container.

Usage

From source file:op.FrmMain.java

/**
 * This method is called from within the constructor to
 * initialize the form.//from w ww .  j a  v a2  s . co m
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    pnlMain = new JPanel();
    pnlMainMessage = new JPanel();
    btnTX = new JButton();
    panel1 = new JPanel();
    pnlIcons = new JPanel();
    lblMainMsg = new JLabel();
    btnExit = new JButton();
    lblSubMsg = new JideLabel();
    btnHelp = new JButton();
    pbMsg = new JProgressBar();
    btnReload = new JButton();
    splitPaneLeft = new JideSplitPane();
    pnlCard = new JPanel();
    pnlWait = new JPanel();
    lblWait = new JLabel();
    pbTimeout = new JProgressBar();
    panel2 = new JPanel();
    btnResetSplitpane = new JButton();
    statusBar = new StatusBar();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Offene-Pflege.de");
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            thisWindowClosing(e);
        }
    });
    Container contentPane = getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS));

    //======== pnlMain ========
    {
        pnlMain.setLayout(new FormLayout("0dlu, $lcgap, pref, $lcgap, left:default:grow, 2*($rgap)",
                "$rgap, pref, $rgap, default:grow, 3dlu, $nlgap, bottom:pref, $lgap, 0dlu"));

        //======== pnlMainMessage ========
        {
            pnlMainMessage.setBackground(new Color(220, 223, 208));
            pnlMainMessage.setBorder(new SoftBevelBorder(SoftBevelBorder.RAISED));
            pnlMainMessage.setLayout(new FormLayout(
                    "0dlu, $lcgap, 23dlu, $lcgap, default:grow, $lcgap, min, $lcgap, 0dlu",
                    "0dlu, $lgap, 15dlu, $lgap, fill:11dlu, $lgap, fill:pref:grow, $lgap, pref, $lgap, 0dlu"));

            //---- btnTX ----
            btnTX.setIcon(new ImageIcon(getClass().getResource("/artwork/32x32/ambulance2.png")));
            btnTX.setBorder(null);
            btnTX.setBorderPainted(false);
            btnTX.setSelectedIcon(null);
            btnTX.setToolTipText("Verlegungsbericht drucken");
            btnTX.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnTX.setPressedIcon(
                    new ImageIcon(getClass().getResource("/artwork/32x32/ambulance2_pressed.png")));
            btnTX.setContentAreaFilled(false);
            btnTX.addActionListener(e -> btnTXActionPerformed(e));
            pnlMainMessage.add(btnTX, CC.xywh(3, 3, 1, 3));

            //======== panel1 ========
            {
                panel1.setOpaque(false);
                panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));

                //======== pnlIcons ========
                {
                    pnlIcons.setOpaque(false);
                    pnlIcons.setLayout(new BoxLayout(pnlIcons, BoxLayout.LINE_AXIS));
                }
                panel1.add(pnlIcons);

                //---- lblMainMsg ----
                lblMainMsg.setText("OPDE");
                lblMainMsg.setFont(new Font("Arial Rounded MT Bold", Font.PLAIN, 22));
                lblMainMsg.setForeground(new Color(105, 80, 69));
                lblMainMsg.setHorizontalAlignment(SwingConstants.CENTER);
                lblMainMsg.setIcon(null);
                lblMainMsg.setHorizontalTextPosition(SwingConstants.LEADING);
                panel1.add(lblMainMsg);
            }
            pnlMainMessage.add(panel1, CC.xy(5, 3, CC.CENTER, CC.DEFAULT));

            //---- btnExit ----
            btnExit.setIcon(new ImageIcon(getClass().getResource("/artwork/32x32/lock.png")));
            btnExit.setBorder(null);
            btnExit.setBorderPainted(false);
            btnExit.setOpaque(false);
            btnExit.setContentAreaFilled(false);
            btnExit.setToolTipText("Abmelden");
            btnExit.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnExit.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/lock_pressed.png")));
            btnExit.addActionListener(e -> btnExitActionPerformed(e));
            pnlMainMessage.add(btnExit, CC.xywh(7, 3, 1, 3));

            //---- lblSubMsg ----
            lblSubMsg.setText("OPDE");
            lblSubMsg.setFont(new Font("Arial", Font.PLAIN, 14));
            lblSubMsg.setForeground(new Color(105, 80, 69));
            lblSubMsg.setHorizontalAlignment(SwingConstants.CENTER);
            lblSubMsg.setVerticalAlignment(SwingConstants.TOP);
            pnlMainMessage.add(lblSubMsg, CC.xywh(5, 5, 1, 3));

            //---- btnHelp ----
            btnHelp.setText(null);
            btnHelp.setIcon(new ImageIcon(getClass().getResource("/artwork/32x32/help.png")));
            btnHelp.setBorderPainted(false);
            btnHelp.setContentAreaFilled(false);
            btnHelp.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/help_pressed.png")));
            btnHelp.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnHelp.addActionListener(e -> btnHelpActionPerformed(e));
            pnlMainMessage.add(btnHelp, CC.xywh(3, 7, 1, 3));

            //---- pbMsg ----
            pbMsg.setValue(50);
            pbMsg.setFont(new Font("Arial Rounded MT Bold", Font.PLAIN, 12));
            pbMsg.setForeground(new Color(105, 80, 69));
            pnlMainMessage.add(pbMsg, CC.xy(5, 9, CC.FILL, CC.FILL));

            //---- btnReload ----
            btnReload.setIcon(new ImageIcon(getClass().getResource("/artwork/32x32/reload0000.png")));
            btnReload.setBorder(null);
            btnReload.setBorderPainted(false);
            btnReload.setOpaque(false);
            btnReload.setContentAreaFilled(false);
            btnReload.setToolTipText("Ansicht aktualisieren");
            btnReload.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnReload
                    .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/reload_pressed.png")));
            btnReload.addActionListener(e -> btnReloadActionPerformed(e));
            pnlMainMessage.add(btnReload, CC.xywh(7, 7, 1, 3));
        }
        pnlMain.add(pnlMainMessage, CC.xywh(3, 2, 4, 1, CC.DEFAULT, CC.FILL));

        //---- splitPaneLeft ----
        splitPaneLeft.setOneTouchExpandable(true);
        splitPaneLeft.setProportionalLayout(true);
        splitPaneLeft.setShowGripper(true);
        splitPaneLeft.addPropertyChangeListener("dividerLocation", e -> splitPaneLeftPropertyChange(e));
        pnlMain.add(splitPaneLeft, CC.xy(3, 4, CC.FILL, CC.FILL));

        //======== pnlCard ========
        {
            pnlCard.setLayout(new CardLayout());

            //======== pnlWait ========
            {
                pnlWait.setLayout(new BorderLayout());

                //---- lblWait ----
                lblWait.setText("text");
                lblWait.setFont(new Font("Arial", Font.BOLD, 22));
                lblWait.setHorizontalAlignment(SwingConstants.CENTER);
                pnlWait.add(lblWait, BorderLayout.CENTER);
            }
            pnlCard.add(pnlWait, "cardWait");
        }
        pnlMain.add(pnlCard, CC.xy(5, 4, CC.FILL, CC.FILL));
        pnlMain.add(pbTimeout, CC.xywh(3, 5, 4, 1, CC.FILL, CC.DEFAULT));

        //======== panel2 ========
        {
            panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));

            //---- btnResetSplitpane ----
            btnResetSplitpane.setText(null);
            btnResetSplitpane
                    .setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/view_top_bottom.png")));
            btnResetSplitpane.setAlignmentY(1.0F);
            btnResetSplitpane.addActionListener(e -> btnResetSplitpaneActionPerformed(e));
            panel2.add(btnResetSplitpane);

            //---- statusBar ----
            statusBar.setBackground(new Color(238, 238, 238));
            statusBar.setAlignmentY(1.0F);
            panel2.add(statusBar);
        }
        pnlMain.add(panel2, CC.xywh(3, 7, 4, 1, CC.FILL, CC.BOTTOM));
    }
    contentPane.add(pnlMain);
    setSize(945, 695);
    setLocationRelativeTo(getOwner());
}

From source file:model.DrawTopologyDiagram.java

@Override
public void init() {

    //create a graph
    Graph<VertexTopology, Number> ig = Graphs.<VertexTopology, Number>synchronizedDirectedGraph(
            new DirectedSparseMultigraph<VertexTopology, Number>());

    ObservableGraph<VertexTopology, Number> og = new ObservableGraph<VertexTopology, Number>(ig);
    og.addGraphEventListener(new GraphEventListener<VertexTopology, Number>() {

        public void handleGraphEvent(GraphEvent<VertexTopology, Number> evt) {
            System.err.println("got " + evt);

        }/*ww w  .  ja va 2 s  .  c  o  m*/
    });
    this.g = og;
    //layouts
    //create a graphdraw
    //        layout = new FRLayout2<String,Number>(g);
    //        layout = new SpringLayout<String,Number>(g);
    //        ((FRLayout)layout).setMaxIterations(200);
    layout = new KKLayout<VertexTopology, Number>(g);

    vv = new VisualizationViewer<VertexTopology, Number>(layout, new Dimension(600, 600));

    createGraph();

    Container content = getContentPane();
    JPanel totalCasesPanel = new JPanel();

    final JPanel scaleGrids = new JPanel(new GridLayout(0, 2));
    scaleGrids.add(new JLabel("   Test Cases      "));
    scaleGrids.add(new JLabel("       "));
    totalCasesPanel.add(scaleGrids);

    JPanel filteredCasesPanel = new JPanel();

    final JPanel filteredGrids = new JPanel(new GridLayout(0, 2));
    filteredGrids.add(new JLabel("   Filtered Cases      "));
    filteredGrids.add(new JLabel("       "));
    filteredCasesPanel.add(filteredGrids);

    JRootPane rp = this.getRootPane();
    rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

    content.setLayout(new BorderLayout());
    content.setBackground(java.awt.Color.lightGray);
    content.setFont(new Font("Serif", Font.PLAIN, 12));

    vv.getModel().getRelaxer().setSleepTime(500);
    vv.setGraphMouse(new DefaultModalGraphMouse<VertexTopology, Number>());

    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);

    vv.setForeground(Color.white);

    FontMetrics fm = vv.getFontMetrics(vv.getFont());
    int width = fm.stringWidth(g.toString());

    Transformer<VertexTopology, Shape> vertexSize = new Transformer<VertexTopology, Shape>() {
        public Shape transform(VertexTopology i) {

            Ellipse2D circle = new Ellipse2D.Double(-20, -20, 40, 40);
            // in this case, the vertex is twice as large                
            return circle;
        }

    };

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller() {
        @Override
        public String transform(Object v) {

            return ((VertexTopology) v).getScreenName();
        }
    });

    vv.getRenderContext().setVertexShapeTransformer(vertexSize);

    //Get picked states
    final PickedState<VertexTopology> pickedState = vv.getPickedVertexState();
    pickedState.addItemListener(new ItemListener() {
        ArrayList<TestCase> outputTestCase = new ArrayList<TestCase>();
        final Map<String, JButton> createdBtns = new HashMap<String, JButton>();

        Map<String, Integer> deviceSelected = new HashMap<String, Integer>(); // not useful

        ArrayList<String> endPointList = new ArrayList<String>();

        @Override
        public void itemStateChanged(ItemEvent e) {
            // TODO Auto-generated method stub
            Object subject = e.getItem();
            if (e.getStateChange() != 1) {
                scaleGrids.removeAll();
                filteredGrids.removeAll();
                endPointList.remove(getScreenName(subject));

                outputTestCase.clear();

                filteredGrids.repaint();
                filteredGrids.add(new JLabel("   Filtered Cases      "));
                filteredGrids.add(new JLabel("       "));

                scaleGrids.repaint();
                scaleGrids.add(new JLabel("   Test Cases      "));
                scaleGrids.add(new JLabel("       "));

                deviceSelected.clear();

            }
            if (e.getStateChange() == 1) {

                for (TestCase testCase : outputTestCase) {
                    scaleGrids.removeAll();
                    scaleGrids.add(new JLabel("   Test Cases      "));
                    scaleGrids.add(new JLabel("       "));

                    filteredGrids.removeAll();
                    filteredGrids.add(new JLabel("   Filtered Cases      "));
                    filteredGrids.add(new JLabel("       "));

                }

                if (subject instanceof VertexTopology) {
                    final VertexTopology edgePicked = (VertexTopology) subject;
                    if (pickedState.isPicked(edgePicked)) {

                        for (TestCase testCase : edgePicked.getTestCaseList()) {
                            if (!outputTestCase.contains(testCase))
                                outputTestCase.add(testCase);
                            System.out.println("The size for reference is " + testCase.inputReferenceMap.size()
                                    + testCase.getName());
                            System.out.println("The size for target is " + testCase.inputTargetMap.size()
                                    + testCase.getName());
                        }

                        if (deviceSelected.get(edgePicked.getScreenName()) != null)
                            deviceSelected.put(edgePicked.getScreenName(),
                                    deviceSelected.get(edgePicked.getScreenName()) + 1);
                        else
                            deviceSelected.put(edgePicked.getScreenName(), 1);

                        endPointList.add(edgePicked.getScreenName());

                    }
                }
            }

            for (TestCase testCase : outputTestCase) {
                JButton btnCase = new JButton(testCase.getName());
                scaleGrids.add(btnCase);

                if (testCase.getInputDeviceList().size() <= endPointList.size())
                    if (testCaseSelected(testCase, endPointList)) {
                        JButton btnCaseFiltered = new JButton(testCase.getName());
                        filteredGrids.add(btnCaseFiltered);
                    }
                ;

            }

            scaleGrids.revalidate();
            scaleGrids.setVisible(true);
        }

    });

    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
    vv.setGraphMouse(graphMouse);
    graphMouse.setMode(ModalGraphMouse.Mode.PICKING);

    content.setPreferredSize(new Dimension(1400, 900));
    content.add(vv);
    switchLayout = new JButton("Switch to SpringLayout");
    //        switchLayout.addActionListener(new ActionListener() {
    //
    //            @SuppressWarnings("unchecked")
    //            public void actionPerformed(ActionEvent ae) {
    //               Dimension d = new Dimension(600,600);
    //                if (switchLayout.getText().indexOf("Spring") > 0) {
    //                    switchLayout.setText("Switch to FRLayout");
    //                    layout = new SpringLayout<String,Number>(g,
    //                        new ConstantTransformer(EDGE_LENGTH));
    //                    layout.setSize(d);
    //                    vv.getModel().setGraphLayout(layout, d);
    //                } else {
    //                    switchLayout.setText("Switch to SpringLayout");
    //                    layout = new FRLayout<String,Number>(g, d);
    //                    vv.getModel().setGraphLayout(layout, d);
    //                }
    //            }
    //        });

    JSplitPane jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, totalCasesPanel, filteredCasesPanel);
    jSplitPane.setResizeWeight(.5d);

    content.add(switchLayout, BorderLayout.SOUTH);
    content.add(jSplitPane, BorderLayout.EAST);
}

From source file:org.broad.igv.cbio.FilterGeneNetworkUI.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    tabbedPane = new JTabbedPane();
    dialogPane = new JPanel();
    panel1 = new JPanel();
    addRow = new JButton();
    contentPane = new JPanel();
    scrollPane1 = new JScrollPane();
    geneTable = new JTable();
    buttonBar = new JPanel();
    totNumGenes = new JLabel();
    keepIsolated = new JCheckBox();
    okButton = new JButton();
    refFilter = new JButton();
    cancelButton = new JButton();
    helpButton = new JButton();
    saveButton = new JButton();
    thresholds = new JPanel();
    contentPanel = new JPanel();
    label2 = new JLabel();
    label3 = new JLabel();
    delInput = new JTextField();
    label4 = new JLabel();
    expUpInput = new JTextField();
    label7 = new JLabel();
    expDownInput = new JTextField();
    ampInput = new JTextField();
    label1 = new JLabel();
    mutInput = new JTextField();
    label6 = new JLabel();
    label8 = new JLabel();
    separator1 = new JSeparator();
    separator3 = new JSeparator();
    separator2 = new JSeparator();
    panel2 = new JPanel();
    textArea1 = new JTextArea();

    //======== this ========
    setMinimumSize(new Dimension(600, 22));
    setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
    Container contentPane2 = getContentPane();
    contentPane2.setLayout(new BorderLayout());

    //======== tabbedPane ========
    {/*w w w  .j a  v a 2  s .com*/
        tabbedPane.setPreferredSize(new Dimension(550, 346));
        tabbedPane.setMinimumSize(new Dimension(550, 346));
        tabbedPane.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                tabbedPaneStateChanged(e);
            }
        });

        //======== dialogPane ========
        {
            dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
            dialogPane.setMinimumSize(new Dimension(443, 300));
            dialogPane.setPreferredSize(new Dimension(443, 300));
            dialogPane.setLayout(new GridBagLayout());
            ((GridBagLayout) dialogPane.getLayout()).columnWidths = new int[] { 0, 0 };
            ((GridBagLayout) dialogPane.getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0 };
            ((GridBagLayout) dialogPane.getLayout()).columnWeights = new double[] { 1.0, 1.0E-4 };
            ((GridBagLayout) dialogPane.getLayout()).rowWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0,
                    1.0E-4 };

            //======== panel1 ========
            {
                panel1.setLayout(new GridBagLayout());
                ((GridBagLayout) panel1.getLayout()).columnWidths = new int[] { 0, 0, 0 };
                ((GridBagLayout) panel1.getLayout()).rowHeights = new int[] { 0, 0 };
                ((GridBagLayout) panel1.getLayout()).columnWeights = new double[] { 0.0, 0.0, 1.0E-4 };
                ((GridBagLayout) panel1.getLayout()).rowWeights = new double[] { 0.0, 1.0E-4 };

                //---- addRow ----
                addRow.setText("Add Filter");
                addRow.setMaximumSize(new Dimension(200, 28));
                addRow.setMinimumSize(new Dimension(100, 28));
                addRow.setPreferredSize(new Dimension(150, 28));
                addRow.setVisible(false);
                addRow.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        addRowActionPerformed(e);
                    }
                });
                panel1.add(addRow, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                        GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
            }
            dialogPane.add(panel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

            //======== contentPane ========
            {
                contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
            }
            dialogPane.add(contentPane, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

            //======== scrollPane1 ========
            {

                //---- geneTable ----
                geneTable.setAutoCreateRowSorter(true);
                scrollPane1.setViewportView(geneTable);
            }
            dialogPane.add(scrollPane1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

            //======== buttonBar ========
            {
                buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
                buttonBar.setLayout(new GridBagLayout());
                ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] { 0, 85, 85, 80 };
                ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] { 1.0, 0.0, 0.0, 0.0 };

                //---- totNumGenes ----
                totNumGenes.setText("Total Genes: #");
                buttonBar.add(totNumGenes, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

                //---- keepIsolated ----
                keepIsolated.setText("Keep Isolated Genes");
                keepIsolated.setVisible(false);
                buttonBar.add(keepIsolated, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

                //---- okButton ----
                okButton.setText("View Network");
                okButton.setToolTipText("Display the network in a web browser");
                okButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        okButtonActionPerformed(e);
                    }
                });
                buttonBar.add(okButton, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                        GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));

                //---- refFilter ----
                refFilter.setText("Refresh Filter");
                refFilter.setVisible(false);
                refFilter.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        refFilterActionPerformed(e);
                    }
                });
                buttonBar.add(refFilter, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                        GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

                //---- cancelButton ----
                cancelButton.setText("Cancel");
                cancelButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cancelButtonActionPerformed(e);
                    }
                });
                buttonBar.add(cancelButton, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

                //---- helpButton ----
                helpButton.setText("Help");
                helpButton.setVisible(false);
                buttonBar.add(helpButton, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

                //---- saveButton ----
                saveButton.setText("Save Table");
                saveButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        saveButtonActionPerformed(e);
                    }
                });
                buttonBar.add(saveButton, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));
            }
            dialogPane.add(buttonBar, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
        }
        tabbedPane.addTab("Filter", dialogPane);

        //======== thresholds ========
        {
            thresholds.setPreferredSize(new Dimension(550, 196));
            thresholds.setMinimumSize(new Dimension(550, 196));
            thresholds.setLayout(null);

            //======== contentPanel ========
            {
                contentPanel.setBorder(new EtchedBorder());
                contentPanel.setLayout(null);

                //---- label2 ----
                label2.setText("Amplification:");
                label2.setHorizontalAlignment(SwingConstants.RIGHT);
                label2.setLabelFor(ampInput);
                label2.setToolTipText("Amplification score, on a log-normalized scale");
                label2.setPreferredSize(new Dimension(90, 18));
                contentPanel.add(label2);
                label2.setBounds(140, 96, label2.getPreferredSize().width, 18);

                //---- label3 ----
                label3.setText("Deletion:");
                label3.setHorizontalAlignment(SwingConstants.RIGHT);
                label3.setLabelFor(delInput);
                label3.setToolTipText("Deletion score, on a log-normalized scale");
                label3.setPreferredSize(new Dimension(60, 16));
                contentPanel.add(label3);
                label3.setBounds(360, 96, label3.getPreferredSize().width, 18);

                //---- delInput ----
                delInput.setText("0.7");
                delInput.setMinimumSize(new Dimension(34, 28));
                delInput.setPreferredSize(new Dimension(45, 28));
                delInput.setMaximumSize(new Dimension(50, 2147483647));
                contentPanel.add(delInput);
                delInput.setBounds(new Rectangle(new Point(240, 162), delInput.getPreferredSize()));

                //---- label4 ----
                label4.setText("Up:");
                label4.setHorizontalAlignment(SwingConstants.RIGHT);
                label4.setLabelFor(expUpInput);
                label4.setToolTipText("Expression score, log-normalized scale");
                label4.setPreferredSize(new Dimension(100, 18));
                contentPanel.add(label4);
                label4.setBounds(130, 168, label4.getPreferredSize().width, 18);

                //---- expUpInput ----
                expUpInput.setText("0.1");
                expUpInput.setMinimumSize(new Dimension(34, 28));
                expUpInput.setPreferredSize(new Dimension(45, 28));
                contentPanel.add(expUpInput);
                expUpInput.setBounds(new Rectangle(new Point(430, 91), expUpInput.getPreferredSize()));

                //---- label7 ----
                label7.setText("Down:");
                label7.setHorizontalAlignment(SwingConstants.RIGHT);
                label7.setLabelFor(expDownInput);
                label7.setToolTipText("Expression score, log-normalized scale");
                label7.setPreferredSize(new Dimension(120, 16));
                contentPanel.add(label7);
                label7.setBounds(300, 168, label7.getPreferredSize().width, 18);

                //---- expDownInput ----
                expDownInput.setText("0.1");
                expDownInput.setPreferredSize(new Dimension(45, 28));
                expDownInput.setMinimumSize(new Dimension(34, 28));
                expDownInput.setMaximumSize(new Dimension(50, 2147483647));
                contentPanel.add(expDownInput);
                expDownInput.setBounds(new Rectangle(new Point(430, 162), expDownInput.getPreferredSize()));

                //---- ampInput ----
                ampInput.setText("0.7");
                ampInput.setMinimumSize(new Dimension(34, 28));
                ampInput.setPreferredSize(new Dimension(45, 28));
                contentPanel.add(ampInput);
                ampInput.setBounds(new Rectangle(new Point(240, 91), ampInput.getPreferredSize()));

                //---- label1 ----
                label1.setText("Mutation:");
                label1.setHorizontalAlignment(SwingConstants.RIGHT);
                label1.setLabelFor(mutInput);
                label1.setToolTipText("Minimum number of mutations found");
                label1.setPreferredSize(new Dimension(66, 18));
                contentPanel.add(label1);
                label1.setBounds(50, 26, label1.getPreferredSize().width, 18);

                //---- mutInput ----
                mutInput.setText("1");
                mutInput.setAutoscrolls(false);
                mutInput.setMinimumSize(new Dimension(34, 28));
                mutInput.setPreferredSize(new Dimension(45, 28));
                contentPanel.add(mutInput);
                mutInput.setBounds(new Rectangle(new Point(240, 21), mutInput.getPreferredSize()));

                //---- label6 ----
                label6.setText("Copy Number:");
                contentPanel.add(label6);
                label6.setBounds(30, 96, label6.getPreferredSize().width, 18);

                //---- label8 ----
                label8.setText("Expression:");
                label8.setHorizontalAlignment(SwingConstants.RIGHT);
                contentPanel.add(label8);
                label8.setBounds(30, 168, 86, 18);
                contentPanel.add(separator1);
                separator1.setBounds(0, 135, 500, 10);
                contentPanel.add(separator3);
                separator3.setBounds(0, 65, 500, 10);

                //---- separator2 ----
                separator2.setPreferredSize(new Dimension(10, 210));
                separator2.setOrientation(SwingConstants.VERTICAL);
                contentPanel.add(separator2);
                separator2.setBounds(new Rectangle(new Point(120, 0), separator2.getPreferredSize()));

                { // compute preferred size
                    Dimension preferredSize = new Dimension();
                    for (int i = 0; i < contentPanel.getComponentCount(); i++) {
                        Rectangle bounds = contentPanel.getComponent(i).getBounds();
                        preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                        preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                    }
                    Insets insets = contentPanel.getInsets();
                    preferredSize.width += insets.right;
                    preferredSize.height += insets.bottom;
                    contentPanel.setMinimumSize(preferredSize);
                    contentPanel.setPreferredSize(preferredSize);
                }
            }
            thresholds.add(contentPanel);
            contentPanel.setBounds(12, 80, 500, 210);

            //======== panel2 ========
            {
                panel2.setLayout(null);

                { // compute preferred size
                    Dimension preferredSize = new Dimension();
                    for (int i = 0; i < panel2.getComponentCount(); i++) {
                        Rectangle bounds = panel2.getComponent(i).getBounds();
                        preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                        preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                    }
                    Insets insets = panel2.getInsets();
                    preferredSize.width += insets.right;
                    preferredSize.height += insets.bottom;
                    panel2.setMinimumSize(preferredSize);
                    panel2.setPreferredSize(preferredSize);
                }
            }
            thresholds.add(panel2);
            panel2.setBounds(new Rectangle(new Point(55, 25), panel2.getPreferredSize()));

            //---- textArea1 ----
            textArea1.setText(
                    "Samples are considered to have a given \"event\" if the value is above the thresholds below.");
            textArea1.setEditable(false);
            textArea1.setLineWrap(true);
            textArea1.setBackground(UIManager.getColor("Button.background"));
            thresholds.add(textArea1);
            textArea1.setBounds(15, 10, 430, 40);

            { // compute preferred size
                Dimension preferredSize = new Dimension();
                for (int i = 0; i < thresholds.getComponentCount(); i++) {
                    Rectangle bounds = thresholds.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = thresholds.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                thresholds.setMinimumSize(preferredSize);
                thresholds.setPreferredSize(preferredSize);
            }
        }
        tabbedPane.addTab("Thresholds", thresholds);

    }
    contentPane2.add(tabbedPane, BorderLayout.NORTH);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:edu.clemson.cs.nestbed.client.gui.ConfigManagerFrame.java

public ConfigManagerFrame(Testbed testbed, Project project, ProjectDeploymentConfiguration config)
        throws RemoteException, NotBoundException, MalformedURLException, ClassNotFoundException {
    super(testbed.getName() + " Deployment Configuration Manager");

    this.testbed = testbed;
    this.project = project;
    this.config = config;

    lookupRemoteManagers();/*from w w w . j a v a  2  s  . com*/
    // TODO:  We need to deregister listeners
    programCompileManager.addRemoteObserver(new ProgramCompileObserver());
    programManager.addRemoteObserver(new ProgramObserver());
    progProfManager.addRemoteObserver(new ProgramProfilingSymbolObserver());
    progProfMsgSymManager.addRemoteObserver(new ProgramProfilingMessageSymbolObserver());

    createComponents();
    programTree.addMouseListener(new ProgramTreeMouseListener());
    programTree.setCellRenderer(new ProgramTreeCellRenderer());
    programTree.setRootVisible(false);
    programTree.setShowsRootHandles(true);
    programTree.setDragEnabled(true);
    programTree.setTransferHandler(new ProgramTreeTransferHandler());
    programTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    profilingSymbolTable.addMouseListener(new ProfilingSymbolTableMouseListener());
    profilingSymbolTable.setModel(new ProfilingSymbolTableModel());
    profilingSymbolTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    new DropTarget(profilingSymbolTable, DnDConstants.ACTION_COPY_OR_MOVE, new ProgramSymbolDropTarget(), true);

    profilingMsgTable.addMouseListener(new ProfilingMessageTableMouseListener());
    profilingMsgTable.setModel(new ProfilingMessageSymbolTableModel());
    profilingMsgTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    new DropTarget(profilingMsgTable, DnDConstants.ACTION_COPY_OR_MOVE, new ProgramMessageSymbolDropTarget(),
            true);

    setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    setJMenuBar(buildMenuBar());

    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    JSplitPane top = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, buildLeftPanel(), buildMoteGridPanel());

    JSplitPane panel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, buildBottomPanel());

    c.add(panel, BorderLayout.CENTER);
}

From source file:fll.scheduler.SchedulerUI.java

public SchedulerUI() {
    super(BASE_TITLE);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    _progressDialog = new ProgressDialog(SchedulerUI.this, "Please Wait");
    _progressDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    setJMenuBar(createMenubar());/* www  .  ja va 2 s  . c  o m*/

    final Container cpane = getContentPane();
    cpane.setLayout(new BorderLayout());

    mTabbedPane = new JTabbedPane();
    cpane.add(mTabbedPane, BorderLayout.CENTER);

    final JPanel scheduleDescriptionPanel = new JPanel(new BorderLayout());
    mTabbedPane.addTab("Description", scheduleDescriptionPanel);

    mDescriptionFilename = new JLabel("");
    scheduleDescriptionPanel.add(createDescriptionToolbar(), BorderLayout.PAGE_START);

    mScheduleDescriptionEditor = new SolverParamsEditor();
    final JScrollPane editorScroller = new JScrollPane(mScheduleDescriptionEditor);
    scheduleDescriptionPanel.add(editorScroller, BorderLayout.CENTER);

    // start out with default values
    mScheduleDescriptionEditor.setParams(new SolverParams());

    final JPanel schedulePanel = new JPanel(new BorderLayout());
    mTabbedPane.addTab("Schedule", schedulePanel);

    mScheduleFilename = new JLabel("");
    schedulePanel.add(createScheduleToolbar(), BorderLayout.PAGE_START);

    mScheduleTable = new JTable();
    mScheduleTable.setAutoCreateRowSorter(true);
    mScheduleTable.setDefaultRenderer(Date.class, schedTableRenderer);
    mScheduleTable.setDefaultRenderer(String.class, schedTableRenderer);
    mScheduleTable.setDefaultRenderer(Integer.class, schedTableRenderer);
    mScheduleTable.setDefaultRenderer(Object.class, schedTableRenderer);
    final JScrollPane dataScroller = new JScrollPane(mScheduleTable);

    violationTable = new JTable();
    violationTable.setDefaultRenderer(String.class, violationTableRenderer);
    violationTable.getSelectionModel().addListSelectionListener(violationSelectionListener);
    final JScrollPane violationScroller = new JScrollPane(violationTable);

    final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dataScroller, violationScroller);
    schedulePanel.add(splitPane, BorderLayout.CENTER);

    // initial state
    mWriteSchedulesAction.setEnabled(false);
    mDisplayGeneralScheduleAction.setEnabled(false);
    mRunOptimizerAction.setEnabled(false);
    mReloadFileAction.setEnabled(false);

    pack();
}

From source file:org.geworkbench.engine.ccm.ComponentConfigurationManagerWindow2.java

/**
 * Set up the GUI/*  ww w.jav  a 2s.  co m*/
 * 
 * @param void
 * @return void
 */
private void initComponents() {
    frame = new JFrame("geWorkbench - Component Configuration Manager");

    topPanel = new JPanel();
    displayLabel = new JLabel();
    String[] displayChoices = { DISPLAY_FILTER_ALL, DISPLAY_ONLY_LOADED, DISPLAY_ONLY_UNLOADED };
    displayComboBox = new JComboBox(displayChoices);
    showByTypeLabel = new JLabel();
    String[] showByTypeChoices = new String[PluginComponent.categoryList.size() + 2];
    showByTypeChoices[0] = SHOW_BY_TYPE_ALL;
    int index = 1;
    for (String s : PluginComponent.categoryList) {
        showByTypeChoices[index] = s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
        index++;
    }
    ;
    showByTypeChoices[index] = SHOW_BY_TYPE_OTHERS;
    Arrays.sort(showByTypeChoices);
    showByTypeComboBox = new JComboBox(showByTypeChoices);
    showByTypeComboBox.setMaximumRowCount(showByTypeChoices.length);
    keywordSearchLabel = new JLabel("Keyword search:");
    keywordSearchField = new JTextField("Enter Text");
    splitPane = new JSplitPane();
    scrollPaneForTextPane = new JScrollPane();
    textPane = new JTextPane();
    bottompanel = new JPanel();
    CellConstraints cc = new CellConstraints();

    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            ccmWindow = null;
        }
    });

    viewLicenseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            viewLicense_actionPerformed(e);
        }
    });

    applyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            applyCcmSelections_actionPerformed(e);
        }
    });
    resetButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            resetCcmSelections_actionPerformed(e);
        }

    });
    closeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            closeCcmSelections_actionPerformed(e);
        }

    });
    componentUpdateButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            componentRemoteUpdate_actionPerformed(e);
        }

    });

    //======== frame ========
    {
        Container frameContentPane = frame.getContentPane();
        frameContentPane.setLayout(new BorderLayout());

        //======== outerPanel ========
        {

            frameContentPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent e) {
                    if ("border".equals(e.getPropertyName()))
                        throw new RuntimeException();
                }
            });

            //======== topPanel ========
            {
                FormLayout topPanelLayout = new FormLayout(
                        " 32dlu, default,  4dlu, default,  32dlu, default,  4dlu, default, 32dlu, default,  4dlu, 64dlu, 32dlu",
                        "center:25dlu");
                topPanel.setLayout(topPanelLayout);

                //---- displayLabel ----
                displayLabel.setText("Display:");
                topPanel.add(displayLabel, cc.xy(2, 1));
                //======== scrollPaneForTopList1 ========
                {
                    //---- displayComboBox ----
                    ActionListener actionListener = new ActionListener() {
                        public void actionPerformed(ActionEvent actionEvent) {
                            ItemSelectable is = (ItemSelectable) actionEvent.getSource();
                            Object[] selections = is.getSelectedObjects();
                            String selection = (String) selections[0];
                            ccmTableModel.setLoadedFilterValue(selection);
                            sorter.setRowFilter(combinedFilter);
                            ccmTableModel.fireTableDataChanged();
                        }
                    };

                    displayComboBox.addActionListener(actionListener);
                }
                topPanel.add(displayComboBox, cc.xy(4, 1));

                //---- showByTypeLabel ----
                showByTypeLabel.setText("Show by type:");
                topPanel.add(showByTypeLabel, cc.xy(6, 1));
                //======== scrollPaneForTopList2 ========
                {
                    //---- showByTypeComboBox ----
                    ActionListener actionListener2 = new ActionListener() {
                        public void actionPerformed(ActionEvent actionEvent) {
                            ItemSelectable is = (ItemSelectable) actionEvent.getSource();
                            Object[] selections = is.getSelectedObjects();
                            String selection = (String) selections[0];
                            ccmTableModel.setTypeFilterValue(selection);
                            sorter.setRowFilter(combinedFilter);
                            ccmTableModel.fireTableDataChanged();
                        }
                    };

                    showByTypeComboBox.addActionListener(actionListener2);
                }
                topPanel.add(showByTypeComboBox, cc.xy(8, 1));

                //---- topLabel3 ----               
                topPanel.add(keywordSearchLabel, cc.xy(10, 1));

                //======== scrollPaneForTopList3 ========
                {
                    // ---- keywordSearchField ----
                    KeyListener actionListener3 = new KeyListener() {

                        public void keyPressed(KeyEvent e) {
                        }

                        public void keyReleased(KeyEvent e) {
                            String text = keywordSearchField.getText();
                            ccmTableModel.setKeywordFilterValue(text);
                            sorter.setRowFilter(combinedFilter);
                            ccmTableModel.fireTableDataChanged();
                        }

                        public void keyTyped(KeyEvent e) {
                        }
                    };

                    keywordSearchField.setText("Enter Text");
                    keywordSearchField.addKeyListener(actionListener3);
                }
                topPanel.add(keywordSearchField, cc.xy(12, 1));
            } // Top Panel
            frameContentPane.add(topPanel, BorderLayout.NORTH);

            //======== splitPane ========
            {
                splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
                splitPane.setResizeWeight(0.5);

                //======== scrollPaneForTable ========
                {
                    //---- table ----
                    ccmTableModel = new CCMTableModel2(manager.componentConfigurationManager);
                    setOriginalChoices();
                    table = new JTable(ccmTableModel);
                    sorter = new TableRowSorter<CCMTableModel2>(ccmTableModel);
                    table.setRowSorter(sorter);

                    table.setDefaultRenderer(Object.class, new CellRenderer());
                    table.setDefaultRenderer(CCMTableModel2.ImageLink.class, new ImageLinkRenderer());
                    table.setDefaultRenderer(CCMTableModel2.HyperLink.class, new HyperLinkRenderer());
                    table.setDefaultRenderer(CCMTableModel2.DownloadLink.class, new DownloadLinkRenderer());
                    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

                    ListSelectionModel cellSM = table.getSelectionModel();
                    cellSM.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                    cellSM.addListSelectionListener(new ListSelectionListener() {
                        public void valueChanged(ListSelectionEvent e) {
                            boolean adjusting = e.getValueIsAdjusting();
                            if (adjusting) {
                                return;
                            }
                            int[] selectedRow = table.getSelectedRows();
                            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
                            if (lsm.isSelectionEmpty()) {
                                textPane.setText(" ");
                            } else {
                                String description = (String) ccmTableModel.getValueAt(
                                        table.convertRowIndexToModel(selectedRow[0]),
                                        CCMTableModel2.DESCRIPTION_INDEX);
                                textPane.setText(description);

                                if (textPane.getCaretPosition() > 1) {
                                    textPane.setCaretPosition(1);
                                }
                            }

                            if (table.getSelectedRow() >= 0) {
                                int modelColumn = table.convertColumnIndexToModel(table.getSelectedColumn());
                                if (modelColumn == CCMTableModel2.AVAILABLE_UPDATE_INDEX)
                                    installRemoteComponent();
                                else
                                    launchBrowser();
                            }
                        }
                    });

                    TableColumn column = table.getColumnModel().getColumn(CCMTableModel2.SELECTION_INDEX);
                    column.setMaxWidth(50);
                    column = table.getColumnModel().getColumn(CCMTableModel2.VERSION_INDEX);
                    column.setMaxWidth(60);
                    column = table.getColumnModel().getColumn(CCMTableModel2.AVAILABLE_UPDATE_INDEX);
                    column.setMaxWidth(60);
                    column = table.getColumnModel().getColumn(CCMTableModel2.TUTORIAL_URL_INDEX_2);
                    column.setMaxWidth(70);
                    column = table.getColumnModel().getColumn(CCMTableModel2.TOOL_URL_INDEX_2);
                    column.setMaxWidth(70);

                    scrollPaneForTable = new JScrollPane(table);
                }
                splitPane.setTopComponent(scrollPaneForTable);

                //======== scrollPaneForTextPane ========
                {
                    //---- textPane ----
                    textPane.setEditable(false);
                    scrollPaneForTextPane.setViewportView(textPane);
                }
                splitPane.setBottomComponent(scrollPaneForTextPane);
            } //======== splitPane ========.
            frameContentPane.add(splitPane, BorderLayout.CENTER);

            //======== bottompanel ========
            {
                bottompanel.setLayout(new FormLayout("20dlu," + "default,  4dlu, " + // view License
                        "default,100dlu, " + // Component Update
                        "default,  4dlu, " + // Apply
                        "default,  4dlu, " + // Reset
                        "default,  4dlu, " + // Cancel
                        "default " // Close
                        , "center:25dlu"));

                viewLicenseButton.setText("View License");
                bottompanel.add(viewLicenseButton, cc.xy(2, 1));

                //---- componentUpdateButton ----
                bottompanel.add(componentUpdateButton, cc.xy(6, 1));

                //---- applyButton ----
                applyButton.setText("Apply");
                bottompanel.add(applyButton, cc.xy(8, 1));

                //---- resetButton ----
                resetButton.setText("Reset");
                bottompanel.add(resetButton, cc.xy(10, 1));

                //---- closeButton ----
                closeButton.setText("Close");
                bottompanel.add(closeButton, cc.xy(12, 1));

            } //======== bottompanel ========.
            frameContentPane.add(bottompanel, BorderLayout.SOUTH);
        } //======== outerPanel ========
        frame.pack();
        frame.setLocationRelativeTo(frame.getOwner());
    } // ============ frame ============

    topPanel.setVisible(true);
    splitPane.setVisible(true);
    scrollPaneForTable.setVisible(true);
    table.setVisible(true);
    scrollPaneForTextPane.setVisible(true);
    textPane.setVisible(true);
    bottompanel.setVisible(true);
    sorter.setRowFilter(combinedFilter);
    frame.setVisible(true);
    splitPane.setDividerLocation(.7d);
}

From source file:Provider.GoogleMapsStatic.TestUI.MySample.java

/**
 * @author Nazmul/*from w  w  w .  j  a v a 2  s .com*/
 */
private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    ttfSizeW = new JTextField("512");
    ttfLat = new JTextField("45.5");
    btnGetMap = new JButton("Get Map");
    btnQuit = new JButton("Quit");
    ttfSizeH = new JTextField("512");
    ttfLon = new JTextField("-73.55");
    ttfZoom = new JTextField("14");
    ttaStatus = new JTextArea();
    checkboxRecvStatus = new JCheckBox();
    checkboxSendStatus = new JCheckBox();
    ttfProgressMsg = new JTextField();
    progressBar = new JProgressBar();
    imgLbl = new JLabel();

    /***
     * @author Dhgiang, jpmolinamatute
     * Created a slider, zoom in/out buttons, conbo box (drop down listbox) for city selection,
     * a panel to group the zoom buttons and the slider bar
     */
    slider = new JSlider(0, 19, 14);
    controlPanel = new JPanel(new GridBagLayout()); // controlPanel was created by jpmolinamatute 
    cities = new JComboBox<Object>(new String[] { "Montreal", "Toronto", // the place setting where the combo box is now used to be a text field
            "Vancouver", "New York City", "Caracas", "Hong Kong" }); // for license key, but it was removed to accommodate space for combo box 
    // @author Dhgiang

    JPanel panel1 = new JPanel();
    JPanel contentPanel = new JPanel();
    JPanel btnPanel = new JPanel();
    JPanel dialogPane = new JPanel();

    JLabel label1 = new JLabel("Select City"); // this used to be the label for license key, it was changed to label as 'select city'
    JLabel label2 = new JLabel("Size Width");
    JLabel label3 = new JLabel("Size Height");
    JLabel label4 = new JLabel("Latitude");
    JLabel label5 = new JLabel("Longitude");
    JLabel label6 = new JLabel("Zoom");

    JButton btnZoomIn = new JButton("-");
    JButton btnZoomOut = new JButton("+");

    /***
     * @author jpmolinamatute
     * Created 8 cardinal points: N,NE,NW; S,SE,SW; E, W; 
     */
    JButton btnSE = new JButton("SE");
    JButton btnS = new JButton("S");
    JButton btnSW = new JButton("SW");
    JButton btnE = new JButton("E");
    JButton btnW = new JButton("W");
    JButton btnNE = new JButton("NE");
    JButton btnN = new JButton("N");
    JButton btnNW = new JButton("NW");

    /*** 
     * @author JPMolinaMatute
     * Creaetd a spaceControl GridBagConstraints object to manage 
     * the cardinal points, and add KeyListener so users can use the
     * 8 cardinal keys on the num pad; initialize dimensions
     * 
     */
    GridBagConstraints spaceControl = new GridBagConstraints();
    spaceControl.insets = new Insets(5, 5, 5, 5);
    controlPanel.addKeyListener(this);
    controlPanel.setSize(new Dimension(512, 512));
    // ---- My Combo Boxes for different city coordinates ----//

    // ======== this ========
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setTitle("Google Static Maps");
    setIconImage(null);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    // ======== dialogPane ========
    {
        dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
        dialogPane.setOpaque(false);
        dialogPane.setLayout(new BorderLayout());

        // ======== contentPanel ========
        {
            contentPanel.setOpaque(false);
            contentPanel.setLayout(new TableLayout(
                    new double[][] { { TableLayoutConstants.FILL }, { TableLayoutConstants.PREFERRED,
                            TableLayoutConstants.FILL, TableLayoutConstants.PREFERRED } }));
            ((TableLayout) contentPanel.getLayout()).setHGap(5);
            ((TableLayout) contentPanel.getLayout()).setVGap(5);

            // ======== panel1 ========
            {
                panel1.setOpaque(false);
                panel1.setBorder(new CompoundBorder(
                        new TitledBorder("Configure the inputs to Google Static Maps"), Borders.DLU2_BORDER));
                panel1.setLayout(new TableLayout(
                        new double[][] { { 0.17, 0.17, 0.17, 0.17, 0.05, TableLayoutConstants.FILL },
                                { TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED,
                                        TableLayoutConstants.PREFERRED } }));
                ((TableLayout) panel1.getLayout()).setHGap(5);
                ((TableLayout) panel1.getLayout()).setVGap(5);

                label1.setHorizontalAlignment(SwingConstants.RIGHT);
                panel1.add(label1, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));
                // ---- label2 ----
                label2.setHorizontalAlignment(SwingConstants.RIGHT);
                panel1.add(label2, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));

                // ---- ttfSizeW ----

                panel1.add(ttfSizeW, new TableLayoutConstraints(1, 0, 1, 0, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));

                // ---- label4 ----

                label4.setHorizontalAlignment(SwingConstants.RIGHT);
                panel1.add(label4, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));

                // ---- ttfLat ----

                panel1.add(ttfLat, new TableLayoutConstraints(3, 0, 3, 0, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));

                // ---- btnGetMap ----
                btnGetMap.setHorizontalAlignment(SwingConstants.LEFT);
                btnGetMap.setMnemonic('G');
                btnGetMap.setActionCommand("getMap");
                btnGetMap.addActionListener(this);
                panel1.add(btnGetMap, new TableLayoutConstraints(5, 0, 5, 0, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));

                // ---- label3 ----
                label3.setHorizontalAlignment(SwingConstants.RIGHT);
                panel1.add(label3, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));

                // ---- ttfSizeH ----

                panel1.add(ttfSizeH, new TableLayoutConstraints(1, 1, 1, 1, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));

                // ---- label5 ----
                label5.setHorizontalAlignment(SwingConstants.RIGHT);
                panel1.add(label5, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));

                // ---- ttfLon ----

                panel1.add(ttfLon, new TableLayoutConstraints(3, 1, 3, 1, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));

                // ---- btnQuit ----
                btnQuit.setMnemonic('Q');
                btnQuit.setHorizontalAlignment(SwingConstants.LEFT);
                btnQuit.setHorizontalTextPosition(SwingConstants.RIGHT);
                btnQuit.setActionCommand("quit");
                btnQuit.addActionListener(this);

                panel1.add(btnQuit, new TableLayoutConstraints(5, 1, 5, 1, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));

                /***
                 * @author Dhgiang
                 * Added an anonymous inner class for ItemLister and event handling for the combo box
                 * Used the switch case condition handling to set coordinates based on the city selected
                 * Juan helped modified this method by adding the startTaskAction() at the end so 
                 * users don't have to click on Get Map button.
                 */

                cities.setSelectedIndex(0); // initialize the city selection item to 0 (or the first item)      

                cities.addItemListener(new ItemListener() {
                    public void itemStateChanged(ItemEvent e) {
                        Integer z = cities.getSelectedIndex();
                        switch (z) {
                        case 0:
                            ttfLat.setText("45.5");
                            ttfLon.setText("-73.55");
                            break;
                        case 1:
                            ttfLat.setText("43.65");
                            ttfLon.setText("-79.38");
                            break;
                        case 2:
                            ttfLat.setText("49.2505");
                            ttfLon.setText("-123.1119");
                            break;
                        case 3:
                            ttfLat.setText("40.7142");
                            ttfLon.setText("-74.0064");
                            break;
                        case 4:
                            ttfLat.setText("10.4901");
                            ttfLon.setText("-66.9151");
                            break;
                        case 5:
                            ttfLat.setText("22.257");
                            ttfLon.setText("114.2");
                            break;
                        default:
                            break;
                        }
                        startTaskAction();
                    }
                });

                /***
                 * @author Dhgiang
                 * Added the combo box to the panel
                 */
                panel1.add(cities, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.FULL,
                        TableLayoutConstraints.FULL));

                // ---- label6 ----
                label6.setHorizontalAlignment(SwingConstants.RIGHT);
                panel1.add(label6, new TableLayoutConstraints(2, 2, 2, 2, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));

                // ---- ttfZoom ----

                panel1.add(ttfZoom, new TableLayoutConstraints(3, 2, 3, 2, TableLayoutConstants.FULL,
                        TableLayoutConstants.FULL));
            }
            {
                btnPanel.setOpaque(false);
                btnPanel.setLayout(new GridLayout(0, 3));

                /****
                 * @author Dhgiang
                 * Initializing the zoom IN / OUT buttons with proper parameters and
                 * adding them to the btnPanel of Panel1 (panel within a panel)
                 */
                // ---- btnZoomIn ----
                btnZoomIn.setHorizontalAlignment(SwingConstants.LEFT);
                btnZoomIn.setHorizontalTextPosition(SwingConstants.RIGHT);
                btnZoomIn.setActionCommand("Zoomin");
                btnZoomIn.addActionListener(this);
                btnPanel.add(btnZoomIn, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL,
                        TableLayoutConstraints.FULL));

                // ---- btnZoomOut ----
                btnZoomOut.setHorizontalAlignment(SwingConstants.RIGHT);
                btnZoomOut.setHorizontalTextPosition(SwingConstants.RIGHT);
                btnZoomOut.setActionCommand("Zoomout");
                btnZoomOut.addActionListener(this);

                btnPanel.add(btnZoomOut, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL,
                        TableLayoutConstraints.FULL));

                /***
                 * @author Dhgiang
                 * Having created a new JSlider slider object, maximum & minimum values 
                 * are initialized along with incremental values
                 * 
                 */
                // ---- slider -----
                slider.setMaximum(19);
                slider.setMinimum(0);
                slider.setPaintTicks(true);
                slider.setMajorTickSpacing(19);
                slider.setMinorTickSpacing(1);
                slider.setPaintTrack(false);
                slider.createStandardLabels(4, 0);

                /***
                 * @author Dhgiang
                 * Added a ChangeListener to the slider so that 
                 * 1) the slider moves left if (-) button is clicked, slider moves right if (+) is clicked
                 * 2) and zoom values will increase or decrease if slider bar is shifted left or right accordingly
                 * 3) after the user releases the click button, the map will display automatically with the values
                 *    set by the slider bar, without having the user to click on get map button
                 */
                slider.addChangeListener(new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent arg0) {
                        Integer a = slider.getValue();

                        if (a >= 0 && a <= 19) {
                            ttfZoom.setText(a.toString());
                            startTaskAction();
                        }

                    }

                });
                slider.setBorder(null);

                /***
                 * @author Dhgiang
                 * Added the slider bar to the button panel
                 */
                btnPanel.add(slider, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL,
                        TableLayoutConstraints.FULL));
            }

            /***
             * @author Dhgiang
             * Adding the button panel to panel1
             */
            panel1.add(btnPanel, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL,
                    TableLayoutConstraints.FULL));
            contentPanel.add(panel1, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstants.FULL,
                    TableLayoutConstants.FULL));

            /***
             * @author jpmolinamatute
             * Initializing coordinates for the cardinal points
             * Adding the cardinal points button to the control panel
             */
            // ---- Cardinals points -----
            btnNW.setActionCommand("Northwest");
            btnNW.addActionListener(this);
            spaceControl.gridx = 0;
            spaceControl.gridy = 0;
            controlPanel.add(btnNW, spaceControl);

            btnN.setActionCommand("North");
            btnN.addActionListener(this);
            spaceControl.gridx = 3;
            spaceControl.gridy = 0;
            controlPanel.add(btnN, spaceControl);

            btnNE.setActionCommand("Northeast");
            btnNE.addActionListener(this);
            spaceControl.gridx = 6;
            spaceControl.gridy = 0;
            controlPanel.add(btnNE, spaceControl);

            btnW.setActionCommand("West");
            btnW.addActionListener(this);
            spaceControl.gridx = 0;
            spaceControl.gridy = 3;
            controlPanel.add(btnW, spaceControl);

            spaceControl.gridx = 3;
            spaceControl.gridy = 3;
            controlPanel.add(imgLbl, spaceControl);

            btnE.setActionCommand("East");
            btnE.addActionListener(this);
            spaceControl.gridx = 6;
            spaceControl.gridy = 3;
            controlPanel.add(btnE, spaceControl);

            btnSW.setActionCommand("Southwest");
            btnSW.addActionListener(this);
            spaceControl.gridx = 0;
            spaceControl.gridy = 6;
            controlPanel.add(btnSW, spaceControl);

            btnS.setActionCommand("South");
            btnS.addActionListener(this);
            spaceControl.gridx = 3;
            spaceControl.gridy = 6;
            controlPanel.add(btnS, spaceControl);

            btnSE.setActionCommand("Southeast");
            btnSE.addActionListener(this);
            spaceControl.gridx = 6;
            spaceControl.gridy = 6;
            controlPanel.add(btnSE, spaceControl);

            contentPanel.add(controlPanel, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstants.FULL,
                    TableLayoutConstants.FULL));

        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);
    }

    contentPane.add(dialogPane, BorderLayout.CENTER);
    setSize(700, 800);

    setLocationRelativeTo(null);
}

From source file:op.care.prescription.DlgOnDemand.java

/**
 * This method is called from within the constructor to
 * initialize the form./*  w w  w . j a v a 2s  .c  o m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jPanel1 = new JPanel();
    txtMed = new JXSearchField();
    cmbMed = new JComboBox<>();
    panel4 = new JPanel();
    btnMedWizard = new JButton();
    cmbIntervention = new JComboBox<>();
    txtSit = new JXSearchField();
    cmbSit = new JComboBox<>();
    panel3 = new JPanel();
    btnAddSit = new JButton();
    txtIntervention = new JXSearchField();
    jPanel2 = new JPanel();
    lblNumber = new JLabel();
    lblDose = new JLabel();
    lblMaxPerDay = new JLabel();
    txtMaxTimes = new JTextField();
    lblX = new JLabel();
    txtEDosis = new JTextField();
    lblCheckResultAfter = new JLabel();
    cmbCheckAfter = new JComboBox<>();
    jPanel3 = new JPanel();
    pnlOFF = new JPanel();
    rbActive = new JRadioButton();
    rbDate = new JRadioButton();
    txtOFF = new JTextField();
    jScrollPane3 = new JScrollPane();
    txtBemerkung = new JTextPane();
    lblText = new JLabel();
    pnlON = new JPanel();
    cmbDocON = new JComboBox<>();
    cmbHospitalON = new JComboBox<>();
    panel1 = new JPanel();
    btnClose = new JButton();
    btnSave = new JButton();

    //======== this ========
    setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    setResizable(false);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("14dlu, $lcgap, default, 6dlu, 355dlu, $lcgap, 14dlu",
            "14dlu, $lgap, fill:default:grow, $lgap, fill:default, $lgap, 14dlu"));

    //======== jPanel1 ========
    {
        jPanel1.setBorder(null);
        jPanel1.setLayout(new FormLayout("68dlu, $lcgap, pref:grow, $lcgap, pref",
                "3*(16dlu, $lgap), default, $lgap, fill:113dlu:grow, $lgap, 60dlu"));

        //---- txtMed ----
        txtMed.setFont(new Font("Arial", Font.PLAIN, 14));
        txtMed.setPrompt("Medikamente");
        txtMed.setFocusBehavior(PromptSupport.FocusBehavior.HIGHLIGHT_PROMPT);
        txtMed.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                txtMedActionPerformed(e);
            }
        });
        txtMed.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                txtMedFocusGained(e);
            }
        });
        jPanel1.add(txtMed, CC.xy(1, 1));

        //---- cmbMed ----
        cmbMed.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbMed.setFont(new Font("Arial", Font.PLAIN, 14));
        cmbMed.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                cmbMedItemStateChanged(e);
            }
        });
        jPanel1.add(cmbMed, CC.xy(3, 1));

        //======== panel4 ========
        {
            panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS));

            //---- btnMedWizard ----
            btnMedWizard.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnMedWizard.setBorderPainted(false);
            btnMedWizard.setBorder(null);
            btnMedWizard.setContentAreaFilled(false);
            btnMedWizard.setToolTipText("Neues Medikament eintragen");
            btnMedWizard.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnMedWizard.setSelectedIcon(
                    new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnMedWizard.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnMedActionPerformed(e);
                }
            });
            panel4.add(btnMedWizard);
        }
        jPanel1.add(panel4, CC.xy(5, 1));

        //---- cmbIntervention ----
        cmbIntervention
                .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbIntervention.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel1.add(cmbIntervention, CC.xywh(3, 5, 3, 1));

        //---- txtSit ----
        txtSit.setPrompt("Situationen");
        txtSit.setFont(new Font("Arial", Font.PLAIN, 14));
        txtSit.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                txtSitActionPerformed(e);
            }
        });
        jPanel1.add(txtSit, CC.xy(1, 3));

        //---- cmbSit ----
        cmbSit.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbSit.setFont(new Font("Arial", Font.PLAIN, 14));
        cmbSit.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                cmbSitItemStateChanged(e);
            }
        });
        cmbSit.addPropertyChangeListener("model", new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent e) {
                cmbSitPropertyChange(e);
            }
        });
        jPanel1.add(cmbSit, CC.xy(3, 3));

        //======== panel3 ========
        {
            panel3.setLayout(new BoxLayout(panel3, BoxLayout.LINE_AXIS));

            //---- btnAddSit ----
            btnAddSit.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnAddSit.setBorderPainted(false);
            btnAddSit.setBorder(null);
            btnAddSit.setContentAreaFilled(false);
            btnAddSit.setToolTipText("Neue  Situation eintragen");
            btnAddSit.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnAddSit.setSelectedIcon(
                    new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnAddSit.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnSituationActionPerformed(e);
                }
            });
            panel3.add(btnAddSit);
        }
        jPanel1.add(panel3, CC.xy(5, 3, CC.RIGHT, CC.DEFAULT));

        //---- txtIntervention ----
        txtIntervention.setFont(new Font("Arial", Font.PLAIN, 14));
        txtIntervention.setPrompt("Massnahmen");
        txtIntervention.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                txtMassActionPerformed(e);
            }
        });
        jPanel1.add(txtIntervention, CC.xy(1, 5));

        //======== jPanel2 ========
        {
            jPanel2.setLayout(new FormLayout("default, $lcgap, pref, $lcgap, default, $lcgap, 37dlu:grow",
                    "23dlu, fill:22dlu, $ugap, default"));

            //---- lblNumber ----
            lblNumber.setText("Anzahl");
            jPanel2.add(lblNumber, CC.xy(3, 1));

            //---- lblDose ----
            lblDose.setText("Dosis");
            jPanel2.add(lblDose, CC.xy(7, 1, CC.CENTER, CC.DEFAULT));

            //---- lblMaxPerDay ----
            lblMaxPerDay.setText("Max. Tagesdosis:");
            jPanel2.add(lblMaxPerDay, CC.xy(1, 2));

            //---- txtMaxTimes ----
            txtMaxTimes.setHorizontalAlignment(SwingConstants.CENTER);
            txtMaxTimes.setText("1");
            txtMaxTimes.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    txtMaxTimesActionPerformed(e);
                }
            });
            txtMaxTimes.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtMaxTimesFocusGained(e);
                }

                @Override
                public void focusLost(FocusEvent e) {
                    txtMaxTimesFocusLost(e);
                }
            });
            jPanel2.add(txtMaxTimes, CC.xy(3, 2));

            //---- lblX ----
            lblX.setText("x");
            jPanel2.add(lblX, CC.xy(5, 2));

            //---- txtEDosis ----
            txtEDosis.setHorizontalAlignment(SwingConstants.CENTER);
            txtEDosis.setText("1.0");
            txtEDosis.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtEDosisFocusGained(e);
                }

                @Override
                public void focusLost(FocusEvent e) {
                    txtEDosisFocusLost(e);
                }
            });
            txtEDosis.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    txtEDosisActionPerformed(e);
                }
            });
            jPanel2.add(txtEDosis, CC.xy(7, 2));

            //---- lblCheckResultAfter ----
            lblCheckResultAfter.setText("Nachkontrolle:");
            jPanel2.add(lblCheckResultAfter, CC.xy(1, 4));

            //---- cmbCheckAfter ----
            cmbCheckAfter.setModel(new DefaultComboBoxModel<>(new String[] { "keine Nachkontrolle",
                    "nach 1 Stunde", "nach 2 Stunden", "nach 3 Stunden" }));
            jPanel2.add(cmbCheckAfter, CC.xywh(3, 4, 5, 1));
        }
        jPanel1.add(jPanel2, CC.xywh(1, 9, 5, 1, CC.CENTER, CC.TOP));
    }
    contentPane.add(jPanel1, CC.xy(5, 3));

    //======== jPanel3 ========
    {
        jPanel3.setBorder(null);
        jPanel3.setLayout(new FormLayout("149dlu", "3*(fill:default, $lgap), fill:100dlu:grow"));

        //======== pnlOFF ========
        {
            pnlOFF.setBorder(new TitledBorder("Absetzung"));
            pnlOFF.setLayout(new FormLayout("pref, 86dlu:grow", "fill:17dlu, $lgap, fill:17dlu"));

            //---- rbActive ----
            rbActive.setText("text");
            rbActive.setSelected(true);
            rbActive.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    rbActiveItemStateChanged(e);
                }
            });
            pnlOFF.add(rbActive, CC.xywh(1, 1, 2, 1));

            //---- rbDate ----
            rbDate.setText(null);
            rbDate.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    rbDateItemStateChanged(e);
                }
            });
            pnlOFF.add(rbDate, CC.xy(1, 3));

            //---- txtOFF ----
            txtOFF.setEnabled(false);
            txtOFF.setFont(new Font("Arial", Font.PLAIN, 14));
            txtOFF.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    txtOFFFocusLost(e);
                }
            });
            pnlOFF.add(txtOFF, CC.xy(2, 3));
        }
        jPanel3.add(pnlOFF, CC.xy(1, 3));

        //======== jScrollPane3 ========
        {

            //---- txtBemerkung ----
            txtBemerkung.addCaretListener(new CaretListener() {
                @Override
                public void caretUpdate(CaretEvent e) {
                    txtBemerkungCaretUpdate(e);
                }
            });
            jScrollPane3.setViewportView(txtBemerkung);
        }
        jPanel3.add(jScrollPane3, CC.xy(1, 7));

        //---- lblText ----
        lblText.setText("Bemerkung:");
        jPanel3.add(lblText, CC.xy(1, 5));

        //======== pnlON ========
        {
            pnlON.setBorder(new TitledBorder("Ansetzung"));
            pnlON.setLayout(new FormLayout("119dlu:grow", "17dlu, $lgap, fill:17dlu"));

            //---- cmbDocON ----
            cmbDocON.setModel(
                    new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            cmbDocON.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    cmbDocONKeyPressed(e);
                }
            });
            pnlON.add(cmbDocON, CC.xy(1, 1));

            //---- cmbHospitalON ----
            cmbHospitalON.setModel(
                    new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            pnlON.add(cmbHospitalON, CC.xy(1, 3));
        }
        jPanel3.add(pnlON, CC.xy(1, 1));
    }
    contentPane.add(jPanel3, CC.xy(3, 3));

    //======== panel1 ========
    {
        panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));

        //---- btnClose ----
        btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png")));
        btnClose.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnClose.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnCloseActionPerformed(e);
            }
        });
        panel1.add(btnClose);

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnSave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnSaveActionPerformed(e);
            }
        });
        panel1.add(btnSave);
    }
    contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT));
    setSize(1035, 515);
    setLocationRelativeTo(getOwner());

    //---- bgMedikament ----
    ButtonGroup bgMedikament = new ButtonGroup();
    bgMedikament.add(rbActive);
    bgMedikament.add(rbDate);
}

From source file:org.freeplane.view.swing.features.time.mindmapmode.NodeList.java

public void startup() {
    if (dialog != null) {
        dialog.toFront();/*from  ww  w .  j  a  v  a 2 s. c om*/
        return;
    }
    NodeList.COLUMN_MODIFIED = TextUtils.getText(PLUGINS_TIME_LIST_XML_MODIFIED);
    NodeList.COLUMN_CREATED = TextUtils.getText(PLUGINS_TIME_LIST_XML_CREATED);
    NodeList.COLUMN_ICONS = TextUtils.getText(PLUGINS_TIME_LIST_XML_ICONS);
    NodeList.COLUMN_TEXT = TextUtils.getText(PLUGINS_TIME_LIST_XML_TEXT);
    NodeList.COLUMN_DATE = TextUtils.getText(PLUGINS_TIME_LIST_XML_DATE);
    NodeList.COLUMN_NOTES = TextUtils.getText(PLUGINS_TIME_LIST_XML_NOTES);
    dialog = new JDialog(Controller.getCurrentController().getViewController().getFrame(), modal /* modal */);
    String windowTitle;
    if (showAllNodes) {
        windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE_ALL_NODES;
    } else {
        windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE;
    }
    dialog.setTitle(TextUtils.getText(windowTitle));
    dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    final WindowAdapter windowListener = new WindowAdapter() {

        @Override
        public void windowGainedFocus(WindowEvent e) {
            mFilterTextSearchField.getEditor().selectAll();
        }

        @Override
        public void windowClosing(final WindowEvent event) {
            disposeDialog();
        }
    };
    dialog.addWindowListener(windowListener);
    dialog.addWindowFocusListener(windowListener);
    UITools.addEscapeActionToDialog(dialog, new AbstractAction() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            disposeDialog();
        }
    });
    final Container contentPane = dialog.getContentPane();
    final GridBagLayout gbl = new GridBagLayout();
    contentPane.setLayout(gbl);
    final GridBagConstraints layoutConstraints = new GridBagConstraints();
    layoutConstraints.gridx = 0;
    layoutConstraints.gridy = 0;
    layoutConstraints.gridwidth = 1;
    layoutConstraints.gridheight = 1;
    layoutConstraints.weightx = 0.0;
    layoutConstraints.weighty = 0.0;
    layoutConstraints.anchor = GridBagConstraints.WEST;
    layoutConstraints.fill = GridBagConstraints.HORIZONTAL;
    contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_FIND)), layoutConstraints);
    layoutConstraints.gridwidth = 1;
    layoutConstraints.gridx++;
    contentPane.add(Box.createHorizontalStrut(40), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(new JLabel(TextUtils.getText("filter_match_case")), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(matchCase, layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(Box.createHorizontalStrut(40), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(useRegexInFind, layoutConstraints);
    layoutConstraints.gridx = 0;
    layoutConstraints.weightx = 1.0;
    layoutConstraints.gridwidth = GridBagConstraints.REMAINDER;
    layoutConstraints.gridy++;
    contentPane.add(/* new JScrollPane */(mFilterTextSearchField), layoutConstraints);
    layoutConstraints.gridy++;
    layoutConstraints.weightx = 0.0;
    layoutConstraints.gridwidth = 1;
    contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_REPLACE)), layoutConstraints);
    layoutConstraints.gridx = 5;
    contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(useRegexInReplace, layoutConstraints);
    layoutConstraints.gridx = 0;
    layoutConstraints.weightx = 1.0;
    layoutConstraints.gridwidth = GridBagConstraints.REMAINDER;
    layoutConstraints.gridy++;
    contentPane.add(/* new JScrollPane */(mFilterTextReplaceField), layoutConstraints);
    dateRenderer = new DateRenderer();
    nodeRenderer = new NodeRenderer();
    notesRenderer = new NotesRenderer();
    iconsRenderer = new IconsRenderer();
    timeTable = new FlatNodeTable();
    timeTable.addKeyListener(new FlatNodeTableKeyListener());
    timeTable.addMouseListener(new FlatNodeTableMouseAdapter());
    timeTable.getTableHeader().setReorderingAllowed(false);
    timeTableModel = updateModel();
    mFlatNodeTableFilterModel = new FlatNodeTableFilterModel(timeTableModel, NodeList.NODE_TEXT_COLUMN);
    sorter = new TableSorter(mFlatNodeTableFilterModel);
    timeTable.setModel(sorter);
    sorter.setTableHeader(timeTable.getTableHeader());
    sorter.setColumnComparator(Date.class, TableSorter.COMPARABLE_COMPARATOR);
    sorter.setColumnComparator(NodeModel.class, TableSorter.LEXICAL_COMPARATOR);
    sorter.setColumnComparator(IconsHolder.class, TableSorter.COMPARABLE_COMPARATOR);
    sorter.setSortingStatus(NodeList.DATE_COLUMN, TableSorter.ASCENDING);
    final JScrollPane pane = new JScrollPane(timeTable);
    UITools.setScrollbarIncrement(pane);
    layoutConstraints.gridy++;
    GridBagConstraints tableConstraints = (GridBagConstraints) layoutConstraints.clone();
    tableConstraints.weightx = 1;
    tableConstraints.weighty = 10;
    tableConstraints.fill = GridBagConstraints.BOTH;
    contentPane.add(pane, tableConstraints);
    mTreeLabel = new JLabel();
    layoutConstraints.gridy++;
    GridBagConstraints treeConstraints = (GridBagConstraints) layoutConstraints.clone();
    treeConstraints.fill = GridBagConstraints.BOTH;
    @SuppressWarnings("serial")
    JScrollPane scrollPane = new JScrollPane(mTreeLabel) {
        @Override
        public boolean isValidateRoot() {
            return false;
        }
    };
    contentPane.add(scrollPane, treeConstraints);
    final AbstractAction exportAction = new AbstractAction(
            TextUtils.getText("plugins/TimeManagement.xml_Export")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            exportSelectedRowsAndClose();
        }
    };
    final JButton exportButton = new JButton(exportAction);
    final AbstractAction replaceAllAction = new AbstractAction(
            TextUtils.getText("plugins/TimeManagement.xml_Replace_All")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            replace(new ReplaceAllInfo());
        }
    };
    final JButton replaceAllButton = new JButton(replaceAllAction);
    final AbstractAction replaceSelectedAction = new AbstractAction(
            TextUtils.getText("plugins/TimeManagement.xml_Replace_Selected")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            replace(new ReplaceSelectedInfo());
        }
    };
    final JButton replaceSelectedButton = new JButton(replaceSelectedAction);
    final AbstractAction gotoAction = new AbstractAction(TextUtils.getText("plugins/TimeManagement.xml_Goto")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            selectSelectedRows();
        }
    };
    final JButton gotoButton = new JButton(gotoAction);
    final AbstractAction disposeAction = new AbstractAction(
            TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_CLOSE)) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            disposeDialog();
        }
    };
    final JButton cancelButton = new JButton(disposeAction);
    /* Initial State */
    gotoAction.setEnabled(false);
    exportAction.setEnabled(false);
    replaceSelectedAction.setEnabled(false);
    final Box bar = Box.createHorizontalBox();
    bar.add(Box.createHorizontalGlue());
    bar.add(cancelButton);
    bar.add(exportButton);
    bar.add(replaceAllButton);
    bar.add(replaceSelectedButton);
    bar.add(gotoButton);
    bar.add(Box.createHorizontalGlue());
    layoutConstraints.gridy++;
    contentPane.add(/* new JScrollPane */(bar), layoutConstraints);
    final JMenuBar menuBar = new JMenuBar();
    final JMenu menu = new JMenu(TextUtils.getText("plugins/TimeManagement.xml_menu_actions"));
    final AbstractAction[] actionList = new AbstractAction[] { gotoAction, replaceSelectedAction,
            replaceAllAction, exportAction, disposeAction };
    for (int i = 0; i < actionList.length; i++) {
        final AbstractAction action = actionList[i];
        final JMenuItem item = menu.add(action);
        item.setIcon(new BlindIcon(UIBuilder.ICON_SIZE));
    }
    menuBar.add(menu);
    dialog.setJMenuBar(menuBar);
    final ListSelectionModel rowSM = timeTable.getSelectionModel();
    rowSM.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(final ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            final ListSelectionModel lsm = (ListSelectionModel) e.getSource();
            final boolean enable = !(lsm.isSelectionEmpty());
            replaceSelectedAction.setEnabled(enable);
            gotoAction.setEnabled(enable);
            exportAction.setEnabled(enable);
        }
    });
    rowSM.addListSelectionListener(new ListSelectionListener() {
        String getNodeText(final NodeModel node) {
            return TextController.getController().getShortText(node)
                    + ((node.isRoot()) ? "" : (" <- " + getNodeText(node.getParentNode())));
        }

        public void valueChanged(final ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            final ListSelectionModel lsm = (ListSelectionModel) e.getSource();
            if (lsm.isSelectionEmpty()) {
                mTreeLabel.setText("");
                return;
            }
            final int selectedRow = lsm.getLeadSelectionIndex();
            final NodeModel mindMapNode = getMindMapNode(selectedRow);
            mTreeLabel.setText(getNodeText(mindMapNode));
        }
    });
    final String marshalled = ResourceController.getResourceController()
            .getProperty(NodeList.WINDOW_PREFERENCE_STORAGE_PROPERTY);
    final WindowConfigurationStorage result = TimeWindowConfigurationStorage.decorateDialog(marshalled, dialog);
    final WindowConfigurationStorage storage = result;
    if (storage != null) {
        timeTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        int column = 0;
        for (final TimeWindowColumnSetting setting : ((TimeWindowConfigurationStorage) storage)
                .getListTimeWindowColumnSettingList()) {
            timeTable.getColumnModel().getColumn(column).setPreferredWidth(setting.getColumnWidth());
            sorter.setSortingStatus(column, setting.getColumnSorting());
            column++;
        }
    }
    mFlatNodeTableFilterModel.setFilter((String) mFilterTextSearchField.getSelectedItem(),
            matchCase.isSelected(), useRegexInFind.isSelected());
    dialog.setVisible(true);
}

From source file:com.opendoorlogistics.studio.AppFrame.java

public AppFrame() {

    // create frame with desktop pane
    Container con = getContentPane();
    con.setLayout(new BorderLayout());

    SwingWorker<BufferedImage, BufferedImage> createBackground = new SwingWorker<BufferedImage, BufferedImage>() {

        @Override//  ww w.  j  a va 2s  .  c o  m
        protected BufferedImage doInBackground() throws Exception {
            // background = new AppBackground().create();
            AppBackground ab = new AppBackground();

            ab.start();
            long lastTime = System.currentTimeMillis();
            int lastRendered = 0;
            while (ab.getNbConsecutiveFails() < 100) {
                ab.doStep();
                long current = System.currentTimeMillis();
                if (current - lastTime > 100 && lastRendered != ab.getNbRendered()) {
                    background = ImageUtils.deepCopy(ab.getImage());
                    publish(background);
                    lastTime = current;
                    lastRendered = ab.getNbRendered();
                }
            }

            ab.finish();

            background = ab.getImage();
            return background;
        }

        @Override
        protected void process(List<BufferedImage> chunks) {
            repaint();
        }

        @Override
        public void done() {
            AppFrame.this.repaint();
        }
    };
    createBackground.execute();

    initWindowPosition();

    registerAppFrameDependentComponents();

    // then create other objects which might use the components
    tables = new DatastoreTablesPanel(this);

    // create scripts panel after registering components
    scriptManager = new ScriptUIManagerImpl(this);
    scriptsPanel = new ScriptsPanel(getApi(), PreferencesManager.getSingleton().getScriptsDirectory(),
            scriptManager);

    // set my icon
    setIconImage(Icons.loadFromStandardPath("App logo.png").getImage());

    // create actions
    fileActions = initFileActions();
    editActions = initEditActions();

    // create left-hand panel with scripts and tables
    splitterTablesScripts = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tables, scriptsPanel);
    splitterTablesScripts.setPreferredSize(new Dimension(200, splitterTablesScripts.getPreferredSize().height));
    splitterTablesScripts.setResizeWeight(0.5);

    // split center part into tables/scripts browser on the left and desktop
    // pane on the right
    desktopScrollPane = new DesktopScrollPane(desktopPane);
    splitterLeftPanelMain = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitterTablesScripts,
            desktopScrollPane);
    con.add(splitterLeftPanelMain, BorderLayout.CENTER);

    // add toolbar
    initToolbar(con);

    initMenus();

    // control close operation to stop changed being lost
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            if (canCloseDatastore()) {
                dispose();
                System.exit(0);
            }
        }
    });

    setVisible(true);
    updateAppearance();

}