Example usage for javax.swing JPanel setOpaque

List of usage examples for javax.swing JPanel setOpaque

Introduction

In this page you can find the example usage for javax.swing JPanel setOpaque.

Prototype

@BeanProperty(expert = true, description = "The component's opacity")
public void setOpaque(boolean isOpaque) 

Source Link

Document

If true the component paints every pixel within its bounds.

Usage

From source file:op.FrmMain.java

private CollapsiblePane addNursingRecords(final Station station) {
    //        bwButtonMap = new HashMap<Resident, JideButton>();

    EntityManager em = OPDE.createEM();/*from  ww w.  j  a  v  a 2s  .  com*/
    Query query;
    if (station == null) {
        query = em.createQuery("SELECT b FROM Resident b WHERE b.station IS NULL ORDER BY b.name, b.firstname");
    } else {
        query = em.createQuery(
                "SELECT b FROM Resident b WHERE b.station = :station ORDER BY b.name, b.firstname");
        query.setParameter("station", station);
    }
    ArrayList<Resident> residentList = new ArrayList<Resident>(query.getResultList());
    em.close();

    CollapsiblePane mypane = new CollapsiblePane(
            station == null ? SYSTools.xx("misc.msg.Archive") : station.getName());
    mypane.setFont(SYSConst.ARIAL14);
    mypane.setEmphasized(station != null && station.equals(StationTools.getStationForThisHost()));
    mypane.setStyle(CollapsiblePane.PLAIN_STYLE);

    JPanel labelPanel = new JPanel();
    labelPanel.setLayout(new VerticalLayout());
    labelPanel.setBackground(Color.WHITE);

    try {
        mypane.setCollapsed(!mypane.isEmphasized());
    } catch (PropertyVetoException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }

    if (!residentList.isEmpty() && station != null) {
        JideButton button = GUITools.createHyperlinkButton("opde.mainframe.printdailyplan",
                SYSConst.icon22print2, new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        if ((e.getModifiers() & InputEvent.CTRL_MASK) != 0) {
                            PrescriptionTools.printDailyPlan(station, "html");
                        } else {
                            PrescriptionTools.printDailyPlan(station, "pdf");
                        }
                    }
                });
        button.setBackground(Color.WHITE);
        labelPanel.add(button);
    }

    for (final Resident resident : residentList) {
        ActionListener actionListener = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                if (currentResident != resident) {

                    if (previousProgButton != null) {
                        previousProgButton.setBackground(Color.WHITE);
                        previousProgButton.setOpaque(false);
                    }

                    previousProgButton = (JideButton) actionEvent.getSource();
                    previousProgButton.setBackground(Color.YELLOW);
                    previousProgButton.setOpaque(true);

                    currentResident = resident;

                    if (currentVisiblePanel instanceof PnlCare) {
                        ((NursingRecordsPanel) currentVisiblePanel).switchResident(resident);
                    } else {
                        setPanelTo(new PnlCare(resident, jspSearch));
                    }

                }
            }
        };

        JPanel singleButtonPanel = new JPanel();
        singleButtonPanel.setLayout(new BoxLayout(singleButtonPanel, BoxLayout.X_AXIS));
        singleButtonPanel.setBorder(null);

        singleButtonPanel.setOpaque(false);

        String titel = resident.getName() + ", " + resident.getFirstname() + " [" + resident.getRIDAnonymous()
                + "]";
        JideButton button = GUITools.createHyperlinkButton(titel, null, actionListener);
        button.setForegroundOfState(ThemePainter.STATE_DEFAULT,
                resident.getGender() == ResidentTools.FEMALE ? Color.red : Color.blue);
        button.setBackground(Color.WHITE);

        singleButtonPanel.add(button);

        OPDE.getDisplayManager().clearSubMessages();

        if (station != null) { // not for the archive
            JPanel pnl = new JPanel();
            pnl.setLayout(new BoxLayout(pnl, BoxLayout.X_AXIS));
            pnl.setOpaque(false);
            pnl.setBorder(null);

            setIconPanel(pnl, resident);

            synchronized (iconPanels) {
                iconPanels.put(resident, pnl);
            }

            singleButtonPanel.add(pnl);
        }

        labelPanel.add(singleButtonPanel);
    }

    mypane.setContentPane(labelPanel);
    listOfNursingrecords.add(mypane);
    return mypane;
}

From source file:op.FrmMain.java

public void setBlocked(boolean blocked) {
    if (blocked) {
        lblWait.setVisible(true);/*from www  .ja v a  2s  .  c om*/
        JPanel glass = new JPanel();
        glass.addMouseListener(new MouseAdapter() {
        });
        glass.addMouseMotionListener(new MouseMotionAdapter() {
        });
        glass.addKeyListener(new KeyAdapter() {
        });
        glass.setOpaque(false);
        setGlassPane(glass);
        getGlassPane().setVisible(true);
        ((CardLayout) pnlCard.getLayout()).show(pnlCard, "cardWait");
    } else {
        getGlassPane().setVisible(false);
        setGlassPane(new JPanel());
        ((CardLayout) pnlCard.getLayout()).show(pnlCard, "cardContent");
    }
}

From source file:op.users.PnlUser.java

private JPanel createMemberPanel4(final Groups group) {

    CollapsiblePane cpMember = new CollapsiblePane(SYSTools.xx("opde.users.members"));
    cpMember.setBackground(bg.darker()); // a little darker
    cpMember.setForeground(Color.WHITE);

    JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new VerticalLayout());
    contentPanel.setOpaque(false);

    cpMember.setContentPane(new PnlEditMembers(group, lstUsers));

    contentPanel.add(cpMember);//from  w  ww  . j  ava  2 s .co  m
    cpMember.setFont(SYSConst.ARIAL14BOLD);

    return contentPanel;
}

From source file:org.apache.cayenne.modeler.editor.AbstractCallbackMethodsTab.java

private void addButtonAtHeader(JTable table, JButton button, ActionListener buttonListener,
        ImageIcon buttonIcon) {//w  w w . j a  v  a2  s  .c  o m
    PanelBuilder builder = new PanelBuilder(new FormLayout("left:10dlu, 2dlu", "center:10dlu"));
    CellConstraints cc = new CellConstraints();

    button.setIcon(buttonIcon);
    button.setOpaque(false);
    button.setBorderPainted(false);
    button.setContentAreaFilled(false);
    button.addActionListener(buttonListener);

    builder.add(button, cc.xy(1, 1));

    JPanel buttonPanel = builder.getPanel();
    buttonPanel.setOpaque(false);

    JTableHeader header = table.getTableHeader();
    header.setLayout(new BorderLayout());
    header.setReorderingAllowed(false);
    header.setPreferredSize(new Dimension(150, 20));
    header.add(buttonPanel, BorderLayout.EAST);
}

From source file:org.apereo.learninganalytics.snapp.ClusteringDemo.java

private void setUpView(Graph<Integer, Number> grp, Map<Integer, String> name) {
    /*//www . j a v  a  2s  .  c o  m
     Factory<Number> vertexFactory = new Factory<Number>() {
    int n = 0;
    public Number create() { return n++; }
      };
      Factory<Number> edgeFactory = new Factory<Number>()  {
    int n = 0;
    public Number create() { return n++; }
      };
            
      PajekNetReader<Graph<Number, Number>, Number,Number> pnr = 
    new PajekNetReader<Graph<Number, Number>, Number,Number>(vertexFactory, edgeFactory);
              
      final Graph<Number,Number> graph = new SparseMultigraph<Number, Number>();
              
      pnr.load(br, graph);
      */

    //Create a simple layout frame
    //specify the Fruchterman-Rheingold layout algorithm

    this.usernames = name;
    final AggregateLayout<Integer, Number> layout = new AggregateLayout<Integer, Number>(
            new FRLayout<Integer, Number>(grp));
    layout.setSize(new Dimension(500, 500));
    vv = new VisualizationViewer<Integer, Number>(layout);
    vv.setBackground(Color.white);
    //Tell the renderer to use our own customized color rendering
    vv.getRenderContext()
            .setVertexFillPaintTransformer(MapTransformer.<Integer, Paint>getInstance(vertexPaints));
    vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Integer, Paint>() {
        public Paint transform(Integer v) {
            if (vv.getPickedVertexState().isPicked(v)) {
                return Color.cyan;
            } else {
                return Color.BLACK;
            }
        }
    });

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

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

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

    vv.getRenderContext().setVertexLabelTransformer(
            // this chains together Transformers so that the html tags
            // are prepended to the toString method output
            new ChainedTransformer<Integer, String>(
                    new Transformer[] { new ToStringLabeller<String>(), new Transformer<String, String>() {
                        public String transform(String input) {
                            return usernames.get(Integer.parseInt(input));
                        }
                    } }));

    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.S);
    /*
          //add restart button
          JButton scramble = new JButton("Restart");
          scramble.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent arg0) {
    Layout layout = vv.getGraphLayout();
    layout.initialize();
    Relaxer relaxer = vv.getModel().getRelaxer();
    if(relaxer != null) {
       relaxer.stop();
       relaxer.prerelax();
       relaxer.relax();
    }
             }
            
          });
    */

    DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
    vv.setGraphMouse(gm);

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

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

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

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

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

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

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

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

    // Add a restart button so the graph can be redrawn to fit the size of the frame
    JFrame jf = new JFrame("SNAPP: Find Clusters");
    //jf.getContentPane().add();

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

    //jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jf.pack();
    jf.setVisible(true);
}

From source file:org.colombbus.tangara.AboutWindow.java

private JPanel bodyPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.setOpaque(false);
    panel.add(Box.createHorizontalStrut(marginLeft));
    panel.add(getTextZone());//from   w  ww.ja va2 s. co  m
    panel.add(Box.createHorizontalStrut(marginButton));
    panel.add(getCloseButton());
    panel.add(Box.createHorizontalStrut(marginButton));
    return panel;
}

From source file:org.colombbus.tangara.update.SoftwareUpdateDialog.java

private void addCenterPane() {
    JPanel centerPane = new JPanel();
    BoxLayout layout = new BoxLayout(centerPane, BoxLayout.Y_AXIS);
    centerPane.setLayout(layout);//w w  w  . j a  v a2  s  . c  o  m

    JTextArea descPane = new JTextArea(info.getDescription());
    descPane.setFont(font);
    descPane.setEditable(false);
    centerPane.add(descPane);

    JPanel linkPanel = new JPanel();
    linkPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    String linkTitle = bundle.getString("SoftwareUpdateDialog.linkTitle"); //$NON-NLS-1$
    JLabel linkTitleLabel = new JLabel(linkTitle);
    linkTitleLabel.setFont(font);
    linkPanel.add(linkTitleLabel);
    HyperLinkLabel linkLabel = new HyperLinkLabel(info.getLink(), info.getLink());
    linkLabel.setFont(font);
    linkPanel.add(linkLabel);
    linkPanel.setBackground(Color.white);
    linkPanel.setOpaque(true);
    centerPane.add(linkPanel);
    add(centerPane, BorderLayout.CENTER);
}

From source file:org.datavyu.views.DataControllerV.java

/**
 * Initialize the view for Macs.//from w w  w . j  a  va 2s.co m
 */
private void initComponentsMac() {
    gridButtonPanel = new javax.swing.JPanel();

    goBackTextField = new javax.swing.JTextField();
    findTextField = new javax.swing.JTextField();
    addDataButton = new javax.swing.JButton();
    timestampLabel = new javax.swing.JLabel();
    lblSpeed = new javax.swing.JLabel();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    findOffsetField = new javax.swing.JTextField();
    showTracksButton = new javax.swing.JButton();
    tracksPanel = new javax.swing.JPanel(new MigLayout("fill"));

    final int fontSize = 11;

    org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application
            .getInstance(org.datavyu.Datavyu.class).getContext().getResourceMap(DataControllerV.class);
    setTitle(resourceMap.getString("title"));
    addWindowListener(new java.awt.event.WindowAdapter() {
        @Override
        public void windowClosing(final java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });

    gridButtonPanel.setBackground(Color.WHITE);
    gridButtonPanel.setLayout(new MigLayout("wrap 5, ins 15 2 15 2"));

    // Add data button
    addDataButton.setText(resourceMap.getString("addDataButton.text"));
    addDataButton.setFont(new Font("Tahoma", Font.PLAIN, fontSize));
    addDataButton.setFocusPainted(false);
    addDataButton.setName("addDataButton");
    addDataButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent evt) {
            openVideoButtonActionPerformed(evt);
        }
    });
    gridButtonPanel.add(addDataButton, "span 2, w 90!, h 25!");

    // Timestamp panel
    JPanel timestampPanel = new JPanel(new MigLayout("", "push[][][]0![]push"));
    timestampPanel.setOpaque(false);

    // Timestamp label
    timestampLabel.setFont(new Font("Tahoma", Font.BOLD, fontSize));
    timestampLabel.setHorizontalAlignment(SwingConstants.CENTER);
    timestampLabel.setText("00:00:00:000");
    timestampLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    timestampLabel.setName("timestampLabel");
    timestampPanel.add(timestampLabel);

    jLabel1.setText("@");
    timestampPanel.add(jLabel1);

    lblSpeed.setFont(new Font("Tahoma", Font.BOLD, fontSize));
    lblSpeed.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 2));
    lblSpeed.setName("lblSpeed");
    lblSpeed.setText("0");
    timestampPanel.add(lblSpeed);

    jLabel2.setFont(new Font("Tahoma", Font.BOLD, fontSize));
    jLabel2.setText("x");
    timestampPanel.add(jLabel2);

    // Set cell onset button
    javax.swing.ActionMap actionMap = org.jdesktop.application.Application
            .getInstance(org.datavyu.Datavyu.class).getContext().getActionMap(DataControllerV.class, this);

    gridButtonPanel.add(timestampPanel, "span 3, pushx, growx");

    // placeholder
    setCellOnsetButton = buildButton(resourceMap, actionMap, "setCellOnset", null);
    gridButtonPanel.add(setCellOnsetButton, "w 45!, h 45!");

    // Sync button
    pointCellButton = buildButton(resourceMap, actionMap, "pointCell", null);
    gridButtonPanel.add(pointCellButton, "w 45!, h 45!");

    // Set cell onset button.
    osxsetCellOffsetButton = buildButton(resourceMap, actionMap, "setCellOffset", "osx");
    gridButtonPanel.add(osxsetCellOffsetButton, "w 45!, h 45!");

    // Instant cell button.
    JButton placeholder2 = new JButton();
    placeholder2.setEnabled(false);
    placeholder2.setFocusPainted(false);
    gridButtonPanel.add(placeholder2, "w 45!, h 45!");

    // Sync video button
    JButton placeholder3 = new JButton();
    placeholder3.setEnabled(false);
    placeholder3.setFocusPainted(false);
    gridButtonPanel.add(placeholder3, "w 80!, h 45!");

    // Rewind video button
    rewindButton = buildButton(resourceMap, actionMap, "rewind", null);
    gridButtonPanel.add(rewindButton, "w 45!, h 45!");

    // Play video button
    playButton = buildButton(resourceMap, actionMap, "play", null);
    playButton.setRequestFocusEnabled(false);
    gridButtonPanel.add(playButton, "w 45!, h 45!");

    // Fast forward button
    forwardButton = buildButton(resourceMap, actionMap, "forward", null);
    gridButtonPanel.add(forwardButton, "w 45!, h 45!");

    // Go back button
    goBackButton = buildButton(resourceMap, actionMap, "goBack", null);
    gridButtonPanel.add(goBackButton, "w 45!, h 45!");

    // Go back text field
    goBackTextField.setHorizontalAlignment(SwingConstants.CENTER);
    goBackTextField.setText("00:00:05:000");
    goBackTextField.setName("goBackTextField");
    gridButtonPanel.add(goBackTextField, "w 80!, h 45!");

    // Shuttle back button
    shuttleBackButton = buildButton(resourceMap, actionMap, "shuttleBack", null);
    gridButtonPanel.add(shuttleBackButton, "w 45!, h 45!");

    // Stop button
    stopButton = buildButton(resourceMap, actionMap, "stop", null);
    gridButtonPanel.add(stopButton, "w 45!, h 45!");

    // Shuttle forward button
    shuttleForwardButton = buildButton(resourceMap, actionMap, "shuttleForward", null);
    gridButtonPanel.add(shuttleForwardButton, "w 45!, h 45!");

    // Find button
    findButton = buildButton(resourceMap, actionMap, "find", null);
    gridButtonPanel.add(findButton, "w 45!, h 45!");

    // Find text field
    findTextField.setHorizontalAlignment(SwingConstants.CENTER);
    findTextField.setText("00:00:00:000");
    findTextField.setName("findOnsetLabel");
    gridButtonPanel.add(findTextField, "w 80!, h 45!");

    // Jog back button
    jogBackButton = buildButton(resourceMap, actionMap, "jogBack", null);
    gridButtonPanel.add(jogBackButton, "w 45!, h 45!");

    // Pause button
    pauseButton = buildButton(resourceMap, actionMap, "pause", null);
    gridButtonPanel.add(pauseButton, "w 45!, h 45!");

    // Jog forward button
    jogForwardButton = buildButton(resourceMap, actionMap, "jogForward", null);
    gridButtonPanel.add(jogForwardButton, "w 45!, h 45!");

    // Create new cell button
    createNewCell = buildButton(resourceMap, actionMap, "createNewCell", null);
    createNewCell.setAlignmentY(0.0F);
    createNewCell.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    gridButtonPanel.add(createNewCell, "span 1 2, w 45!, h 92!");

    // Find offset field
    findOffsetField.setHorizontalAlignment(SwingConstants.CENTER);
    findOffsetField.setText("00:00:00:000");
    findOffsetField.setToolTipText(resourceMap.getString("findOffsetField.toolTipText"));
    findOffsetField.setEnabled(false);
    findOffsetField.setName("findOffsetLabel");
    gridButtonPanel.add(findOffsetField, "w 80!, h 45!");

    // Create new cell setting offset button
    createNewCellSettingOffset = buildButton(resourceMap, actionMap, "createNewCellAndSetOnset", null);
    gridButtonPanel.add(createNewCellSettingOffset, "span 2, w 92!, h 45!");

    // Set cell offset button
    setCellOffsetButton = buildButton(resourceMap, actionMap, "setCellOffset", null);
    gridButtonPanel.add(setCellOffsetButton, "w 45!, h 45!");

    // Show tracks button
    showTracksButton.setIcon(resourceMap.getIcon("showTracksButton.hide.icon"));
    showTracksButton.setName("showTracksButton");
    showTracksButton.getAccessibleContext().setAccessibleName("Show Tracks");
    showTracksButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent evt) {
            showTracksButtonActionPerformed(evt);
        }
    });
    gridButtonPanel.add(showTracksButton, "w 80!, h 45!");

    getContentPane().setLayout(new MigLayout("hidemode 3, fillx", "[growprio 0]0[]", ""));
    getContentPane().add(gridButtonPanel, "");
    getContentPane().setBackground(Color.WHITE);

    tracksPanel.setBackground(Color.WHITE);
    tracksPanel.setVisible(false);
    getContentPane().add(tracksPanel, "growx");

    pack();
}

From source file:org.datavyu.views.DataControllerV.java

/**
 * Initialize the view for OS other than Macs.
 *//*from   w  ww . j  a v a  2  s . co  m*/
private void initComponents() {
    gridButtonPanel = new javax.swing.JPanel();
    goBackTextField = new javax.swing.JTextField();
    findTextField = new javax.swing.JTextField();
    addDataButton = new javax.swing.JButton();
    timestampLabel = new javax.swing.JLabel();
    lblSpeed = new javax.swing.JLabel();
    createNewCell = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    findOffsetField = new javax.swing.JTextField();
    showTracksButton = new javax.swing.JButton();
    tracksPanel = new javax.swing.JPanel(new MigLayout("fill"));

    final int fontSize = 11;

    org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application
            .getInstance(org.datavyu.Datavyu.class).getContext().getResourceMap(DataControllerV.class);
    setTitle(resourceMap.getString("title"));
    addWindowListener(new java.awt.event.WindowAdapter() {
        @Override
        public void windowClosing(final java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });

    gridButtonPanel.setBackground(Color.WHITE);
    gridButtonPanel.setLayout(new MigLayout("wrap 5"));

    // Add data button
    addDataButton.setText(resourceMap.getString("addDataButton.text"));
    addDataButton.setFont(new Font("Tahoma", Font.PLAIN, fontSize));
    addDataButton.setFocusPainted(false);
    addDataButton.setName("addDataButton");
    addDataButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent evt) {
            openVideoButtonActionPerformed(evt);
        }
    });
    gridButtonPanel.add(addDataButton, "span 2, w 90!, h 25!");

    // Timestamp panel
    JPanel timestampPanel = new JPanel(new MigLayout("", "push[][][]0![]push"));
    timestampPanel.setOpaque(false);

    // Timestamp label
    timestampLabel.setFont(new Font("Tahoma", Font.BOLD, fontSize));
    timestampLabel.setHorizontalAlignment(SwingConstants.CENTER);
    timestampLabel.setText("00:00:00:000");
    timestampLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    timestampLabel.setName("timestampLabel");
    timestampPanel.add(timestampLabel);

    jLabel1.setText("@");
    timestampPanel.add(jLabel1);

    lblSpeed.setFont(new Font("Tahoma", Font.BOLD, fontSize));
    lblSpeed.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 2));
    lblSpeed.setName("lblSpeed");
    lblSpeed.setText("0");
    timestampPanel.add(lblSpeed);

    jLabel2.setFont(new Font("Tahoma", Font.BOLD, fontSize));
    jLabel2.setText("x");
    timestampPanel.add(jLabel2);

    javax.swing.ActionMap actionMap = org.jdesktop.application.Application
            .getInstance(org.datavyu.Datavyu.class).getContext().getActionMap(DataControllerV.class, this);

    gridButtonPanel.add(timestampPanel, "span 3, pushx, growx");

    JButton placeholder = new JButton();
    placeholder.setEnabled(false);
    placeholder.setFocusPainted(false);
    gridButtonPanel.add(placeholder, "w 45!, h 45!");

    // Set cell onset button
    setCellOnsetButton = buildButton(resourceMap, actionMap, "setCellOnset", "win");
    gridButtonPanel.add(setCellOnsetButton, "w 45!, h 45!");

    // Set new cell offset button
    pointCellButton = buildButton(resourceMap, actionMap, "pointCell", "win");
    gridButtonPanel.add(pointCellButton, "w 45!, h 45!");

    // Go back button
    goBackButton = buildButton(resourceMap, actionMap, "goBack", null);
    gridButtonPanel.add(goBackButton, "w 45!, h 45!");

    // Sync video button
    JButton placeholder2 = new JButton();
    placeholder2.setEnabled(false);
    placeholder2.setFocusPainted(false);
    gridButtonPanel.add(placeholder2, "w 80!, h 45!");

    // Rewind video button
    rewindButton = buildButton(resourceMap, actionMap, "rewind", null);
    gridButtonPanel.add(rewindButton, "w 45!, h 45!");

    // Play video button
    playButton = buildButton(resourceMap, actionMap, "play", null);
    playButton.setRequestFocusEnabled(false);
    gridButtonPanel.add(playButton, "w 45!, h 45!");

    // Fast forward button
    forwardButton = buildButton(resourceMap, actionMap, "forward", null);
    gridButtonPanel.add(forwardButton, "w 45!, h 45!");

    // Find button
    findButton = buildButton(resourceMap, actionMap, "find", "win");
    gridButtonPanel.add(findButton, "span 1 2, w 45!, h 95!");

    // Go back text field
    goBackTextField.setHorizontalAlignment(SwingConstants.CENTER);
    goBackTextField.setText("00:00:05:000");
    goBackTextField.setName("goBackTextField");
    gridButtonPanel.add(goBackTextField, "w 80!, h 45!");

    // Shuttle back button
    shuttleBackButton = buildButton(resourceMap, actionMap, "shuttleBack", null);
    gridButtonPanel.add(shuttleBackButton, "w 45!, h 45!");

    // Stop button
    stopButton = buildButton(resourceMap, actionMap, "stop", null);
    gridButtonPanel.add(stopButton, "w 45!, h 45!");

    // Shuttle forward button
    shuttleForwardButton = buildButton(resourceMap, actionMap, "shuttleForward", null);
    gridButtonPanel.add(shuttleForwardButton, "w 45!, h 45!");

    // Find text field
    findTextField.setHorizontalAlignment(SwingConstants.CENTER);
    findTextField.setText("00:00:00:000");
    findTextField.setName("findOnsetLabel");
    gridButtonPanel.add(findTextField, "w 80!, h 45!");

    // Jog back button
    jogBackButton = buildButton(resourceMap, actionMap, "jogBack", null);
    gridButtonPanel.add(jogBackButton, "w 45!, h 45!");

    // Pause button
    pauseButton = buildButton(resourceMap, actionMap, "pause", null);
    gridButtonPanel.add(pauseButton, "w 45!, h 45!");

    // Jog forward button
    jogForwardButton = buildButton(resourceMap, actionMap, "jogForward", null);
    gridButtonPanel.add(jogForwardButton, "w 45!, h 45!");

    // Create new cell button
    createNewCell = buildButton(resourceMap, actionMap, "createNewCell", null);
    createNewCell.setAlignmentY(0.0F);
    createNewCell.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    gridButtonPanel.add(createNewCell, "span 1 2, w 45!, h 95!");

    // Find offset field
    findOffsetField.setHorizontalAlignment(SwingConstants.CENTER);
    findOffsetField.setText("00:00:00:000");
    findOffsetField.setToolTipText(resourceMap.getString("findOffsetField.toolTipText"));
    findOffsetField.setEnabled(false);
    findOffsetField.setName("findOffsetLabel");
    gridButtonPanel.add(findOffsetField, "w 80!, h 45!");

    // Create new cell setting offset button
    createNewCellSettingOffset = buildButton(resourceMap, actionMap, "createNewCellAndSetOnset", null);
    gridButtonPanel.add(createNewCellSettingOffset, "span 2, w 95!, h 45!");

    // Set cell offset button
    setCellOffsetButton = buildButton(resourceMap, actionMap, "setCellOffset", null);
    gridButtonPanel.add(setCellOffsetButton, "w 45!, h 45!");

    // Show tracks button
    showTracksButton.setIcon(resourceMap.getIcon("showTracksButton.hide.icon"));
    showTracksButton.setName("showTracksButton");
    showTracksButton.getAccessibleContext().setAccessibleName("Show Tracks");
    showTracksButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent evt) {
            showTracksButtonActionPerformed(evt);
        }
    });
    gridButtonPanel.add(showTracksButton, "w 80!, h 45!");

    getContentPane().setLayout(new MigLayout("ins 0, hidemode 3, fillx", "[growprio 0]0[]", ""));
    getContentPane().add(gridButtonPanel, "");
    getContentPane().setBackground(Color.WHITE);

    tracksPanel.setBackground(Color.WHITE);
    tracksPanel.setVisible(false);
    getContentPane().add(tracksPanel, "growx");

    pack();
}

From source file:org.dishevelled.brainstorm.BrainStorm.java

/**
 * Layout components./*from   w w  w . j  a v a  2  s  . co  m*/
 */
private void layoutComponents() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setBorder(null);
    scrollPane.setOpaque(true);
    scrollPane.setBackground(backgroundColor);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    add(placeholder);

    JPanel flow = new JPanel();
    flow.setLayout(new FlowLayout());
    flow.setOpaque(false);
    flow.add(scrollPane);

    add(flow);
    add(Box.createVerticalGlue());
    add(Box.createVerticalGlue());
}