Example usage for javax.swing SwingConstants CENTER

List of usage examples for javax.swing SwingConstants CENTER

Introduction

In this page you can find the example usage for javax.swing SwingConstants CENTER.

Prototype

int CENTER

To view the source code for javax.swing SwingConstants CENTER.

Click Source Link

Document

The central position in an area.

Usage

From source file:com.mirth.connect.client.ui.browsers.event.EventBrowser.java

/**
 * Creates the table with all of the information given after being filtered by the specified
 * 'filter'//  ww w.  ja va  2 s  .  c  om
 */
private void makeEventTable() {
    updateEventTable(null);

    eventTable.setSelectionMode(0);
    eventTable.setMirthColumnControlEnabled(true);
    eventTable.restoreColumnPreferences();

    eventTable.getColumnExt(EVENT_LEVEL_COLUMN_NAME)
            .setCellRenderer(new ImageCellRenderer(SwingConstants.CENTER));
    eventTable.getColumnExt(EVENT_OUTCOME_COLUMN_NAME)
            .setCellRenderer(new ImageCellRenderer(SwingConstants.CENTER));

    eventTable.getColumnExt(EVENT_ID_COLUMN_NAME).setVisible(false);

    DateCellRenderer dateCellRenderer = new DateCellRenderer();
    dateCellRenderer.setDateFormat(new SimpleDateFormat(DATE_FORMAT));

    eventTable.getColumnExt(EVENT_DATE_COLUMN_NAME).setCellRenderer(dateCellRenderer);
    eventTable.getColumnExt(EVENT_DATE_COLUMN_NAME).setMinWidth(140);
    eventTable.getColumnExt(EVENT_DATE_COLUMN_NAME).setMaxWidth(140);
    eventTable.getColumnExt(EVENT_LEVEL_COLUMN_NAME).setMinWidth(50);
    eventTable.getColumnExt(EVENT_LEVEL_COLUMN_NAME).setMaxWidth(50);
    eventTable.getColumnExt(EVENT_SERVER_ID_COLUMN_NAME).setMinWidth(220);
    eventTable.getColumnExt(EVENT_SERVER_ID_COLUMN_NAME).setMaxWidth(220);
    eventTable.getColumnExt(EVENT_OUTCOME_COLUMN_NAME).setMinWidth(65);
    eventTable.getColumnExt(EVENT_OUTCOME_COLUMN_NAME).setMaxWidth(65);

    eventTable.setRowHeight(UIConstants.ROW_HEIGHT);
    eventTable.setOpaque(true);
    eventTable.setRowSelectionAllowed(true);
    deselectRows();

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        eventTable.setHighlighters(highlighter);
    }

    eventPane.setViewportView(eventTable);
    eventSplitPane.setLeftComponent(eventPane);

    eventTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent evt) {
            EventListSelected(evt);
        }
    });

    eventTable.addMouseListener(new java.awt.event.MouseAdapter() {

        public void mousePressed(java.awt.event.MouseEvent evt) {
            checkSelectionAndPopupMenu(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            checkSelectionAndPopupMenu(evt);
        }
    });

    // Set highlighter.
    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        eventTable.setHighlighters(highlighter);
    }
}

From source file:edu.ku.brc.specify.Specify.java

/**
 * //from w w  w .j a va 2s.com
 */
private void startupContinuing() // needs to be called on the UI Thread
{
    // Adjust Default Swing UI Default Resources (Color, Fonts, etc) per Platform
    UIHelper.adjustUIDefaults();

    setupDefaultFonts();

    if (!UIRegistry.doesAppversionsMatch()) {
        System.exit(0);
    }

    // Attachment related helpers
    Thumbnailer thumb = Thumbnailer.getInstance();
    File thumbnailDir = null;
    try {
        thumbnailDir = XMLHelper.getConfigDir("thumbnail_generators.xml"); //$NON-NLS-1$
        thumb.registerThumbnailers(thumbnailDir);
    } catch (Exception e1) {
        throw new RuntimeException("Couldn't find thumbnailer xml [" //$NON-NLS-1$
                + (thumbnailDir != null ? thumbnailDir.getAbsolutePath() : "") + "]"); //$NON-NLS-1$ //$NON-NLS-2$
    }
    thumb.setQuality(.5f);
    thumb.setMaxSize(256, 256);

    // Load Local Prefs
    AppPreferences localPrefs = AppPreferences.getLocalPrefs();
    //localPrefs.setDirPath(UIRegistry.getAppDataDir());
    //localPrefs.load(); moved to end for not-null constraint
    /*String         derbyPath  = localPrefs.get("javadb.location", null);
    if (StringUtils.isNotEmpty(derbyPath))
    {
    UIRegistry.setJavaDBDir(derbyPath);
    log.debug("JavaDB Path: "+UIRegistry.getJavaDBPath());
    }*/

    String userSplashIconPath = AppPreferences.getLocalPrefs().get("specify.bg.image", null);
    if (userSplashIconPath != null) {
        SystemPrefs.changeSplashImage();
    }

    AttachmentUtils.setThumbnailer(thumb);
    DefaultClassActionHandler defClassActionHandler = DefaultClassActionHandler.getInstance();
    ActionListener attachmentDisplayer = AttachmentUtils.getAttachmentDisplayer();

    Class<?>[] attachmentClasses = { Attachment.class, AccessionAttachment.class, AgentAttachment.class,
            BorrowAttachment.class, CollectingEventAttachment.class, CollectionObjectAttachment.class,
            ConservDescriptionAttachment.class, ConservEventAttachment.class, DNASequenceAttachment.class,
            DNASequencingRunAttachment.class, FieldNotebookAttachment.class, FieldNotebookPageAttachment.class,
            FieldNotebookPageSetAttachment.class, GiftAttachment.class, LoanAttachment.class,
            LocalityAttachment.class, PermitAttachment.class, PreparationAttachment.class,
            ReferenceWorkAttachment.class, RepositoryAgreementAttachment.class, StorageAttachment.class,
            TaxonAttachment.class, TreatmentEventAttachment.class, };

    for (Class<?> cls : attachmentClasses) {
        defClassActionHandler.registerActionHandler(cls, attachmentDisplayer);
    }

    UsageTracker.incrUsageCount("RunCount"); //$NON-NLS-1$

    //UIHelper.attachUnhandledException();

    FileCache.setDefaultPath(UIRegistry.getAppDataDir() + File.separator + "cache"); //$NON-NLS-1$

    cacheManager.registerCache(UIRegistry.getLongTermFileCache());
    cacheManager.registerCache(UIRegistry.getShortTermFileCache());
    cacheManager.registerCache(UIRegistry.getFormsCache());
    cacheManager.registerCache(JasperReportsCache.getInstance());

    UIRegistry.register(UIRegistry.MAINPANE, this); // important to be done immediately

    specifyApp = this;

    // this code simply demonstrates the creation of a system tray icon for Sp6
    // perhaps someday we may want to use this capability
    //        SystemTray sysTray = SystemTray.getSystemTray();
    //        PopupMenu popup = new PopupMenu("Sp6");
    //        MenuItem exitItem = new MenuItem("Exit");
    //        exitItem.addActionListener(new ActionListener()
    //        {
    //            public void actionPerformed(ActionEvent ae)
    //            {
    //                doExit();
    //            }
    //        });
    //        popup.add(exitItem);
    //        TrayIcon sp6icon = new TrayIcon(IconManager.getIcon("Specify16").getImage(),"Sepcify 6",popup);
    //        try
    //        {
    //            sysTray.add(sp6icon);
    //        }
    //        catch (AWTException e1)
    //        {
    //            // TODO Auto-generated catch block
    //            e1.printStackTrace();
    //        }

    //log.info("Creating Database configuration "); //$NON-NLS-1$

    if (!isWorkbenchOnly) {
        HibernateUtil.setListener("post-commit-update", //$NON-NLS-1$
                new edu.ku.brc.specify.dbsupport.PostUpdateEventListener());
        HibernateUtil.setListener("post-commit-insert", //$NON-NLS-1$
                new edu.ku.brc.specify.dbsupport.PostInsertEventListener());
        // SInce Update get called when deleting an object there is no need to register this class.
        // The update deletes because first it removes the Lucene document and then goes to add it back in, but since the
        // the record is deleted it doesn't get added.
        HibernateUtil.setListener("post-commit-delete", //$NON-NLS-1$
                new edu.ku.brc.specify.dbsupport.PostDeleteEventListener());
        //HibernateUtil.setListener("delete", new edu.ku.brc.specify.dbsupport.DeleteEventListener());
    }
    adjustLocaleFromPrefs();

    CommandDispatcher.register(BaseTask.APP_CMD_TYPE, this);

    CommandDispatcher.register(ERRMSG, this);

    DatabaseLoginPanel.MasterPasswordProviderIFace usrPwdProvider = new DatabaseLoginPanel.MasterPasswordProviderIFace() {
        @Override
        public boolean hasMasterUserAndPwdInfo(final String username, final String password,
                final String dbName) {
            if (StringUtils.isNotEmpty(username) && StringUtils.isNotEmpty(password)) {
                UserAndMasterPasswordMgr.getInstance().set(username, password, dbName);
                return UserAndMasterPasswordMgr.getInstance().hasMasterUsernameAndPassword();
            }
            return false;
        }

        @Override
        public Pair<String, String> getUserNamePassword(final String username, final String password,
                final String dbName) {
            UserAndMasterPasswordMgr.getInstance().set(username, password, dbName);

            Pair<String, String> usrPwd = UserAndMasterPasswordMgr.getInstance().getUserNamePasswordForDB();

            return usrPwd;
        }

        @Override
        public boolean editMasterInfo(final String username, final String databaseNameArg,
                final boolean askForCredentials) {
            return UserAndMasterPasswordMgr.getInstance().editMasterInfo(username, databaseNameArg,
                    askForCredentials);
        }

    };

    if (UIRegistry.isMobile()) {
        DBConnection.setShutdownUI(new DBConnection.ShutdownUIIFace() {
            CustomDialog processDlg;

            /* (non-Javadoc)
             * @see edu.ku.brc.dbsupport.DBConnection.ShutdownUIIFace#displayInitialDlg()
             */
            @Override
            public void displayInitialDlg() {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        UIRegistry.showLocalizedMsg(JOptionPane.INFORMATION_MESSAGE, "MOBILE_INFO",
                                "MOBILE_INTRO");
                    }
                });
            }

            /* (non-Javadoc)
             * @see edu.ku.brc.dbsupport.DBConnection.ShutdownUIIFace#displayFinalShutdownDlg()
             */
            @Override
            public void displayFinalShutdownDlg() {
                processDlg.setVisible(false);
                UIRegistry.showLocalizedMsg(JOptionPane.INFORMATION_MESSAGE, "MOBILE_INFO", "MOBILE_FINI");
            }

            /* (non-Javadoc)
             * @see edu.ku.brc.dbsupport.DBConnection.ShutdownUIIFace#displayShutdownMsgDlg()
             */
            @Override
            public void displayShutdownMsgDlg() {
                JPanel panel = new JPanel(new BorderLayout());
                panel.setBorder(BorderFactory.createEmptyBorder(14, 14, 14, 14));

                panel.add(new JLabel(IconManager.getIcon(getLargeIconName()), SwingConstants.CENTER),
                        BorderLayout.WEST);
                panel.add(UIHelper.createI18NLabel("MOBILE_SHUTTING_DOWN", SwingConstants.CENTER),
                        BorderLayout.CENTER);
                processDlg = new CustomDialog((Frame) null, "Shutdown", false, CustomDialog.NONE_BTN, panel);
                processDlg.setAlwaysOnTop(true);

                UIHelper.centerAndShow(processDlg);

            }
        });
    }

    /*long lastSaved = AppPreferences.getLocalPrefs().getLong("update_time", 0L);
    if (lastSaved > 0)
    {
    Date now = Calendar.getInstance().getTime();
            
    double elapsedMinutes = (now.getTime() - lastSaved) / 60000.0;
    log.debug(elapsedMinutes);
    if (elapsedMinutes < 1.0)
    {
        AppPreferences.setBlockTimer();
        UIRegistry.showError("You are currently logged in.\n Logging in twice will cause problems for your account.");
        System.exit(0);
    }
    }*/
    UIRegistry.dumpPaths();

    dbLoginPanel = UIHelper.doLogin(usrPwdProvider, true, false, false, this, getLargeIconName(), getTitle(),
            null, getOpaqueIconName(), "login"); // true means do auto login if it can, second bool means use dialog instead of frame
    localPrefs.load();
}

From source file:greenfoot.gui.export.ExportPublishPane.java

/**
 * Creates the tag display with popular tags and an option to add tags
 *///w w w  . j a  v  a 2  s.c  o  m
private JComponent getTagDisplay() {
    JComponent tagPanel = new JPanel(new MiksGridLayout(3, 1, 8, 8));
    {
        tagPanel.setBackground(background);
        JComponent popPanel = new JPanel(new MiksGridLayout(8, 1, 8, 0));
        popPanel.setBackground(background);
        JLabel popLabel = new JLabel(Config.getString("export.publish.tags.popular"), SwingConstants.LEADING);
        popLabel.setFont(font);
        popPanel.add(popLabel);
        for (int i = 0; i < popTags.length; i++) {
            JCheckBox popTag = new JCheckBox(Config.getString("export.publish.tags.loading"));
            popTag.setBackground(background);
            popTag.setFont(font);
            popTag.setEnabled(false);
            popTags[i] = popTag;
            popPanel.add(popTag);
        }

        tagPanel.add(popPanel);

        Box textPanel = new Box(BoxLayout.Y_AXIS);
        {
            JLabel additionalLabel = new JLabel(Config.getString("export.publish.tags.additional1"),
                    SwingConstants.LEADING);
            additionalLabel.setFont(font);
            textPanel.add(additionalLabel);

            JLabel additionalLabel2 = new JLabel(Config.getString("export.publish.tags.additional2"),
                    SwingConstants.CENTER);
            additionalLabel2.setFont(font);
            textPanel.add(additionalLabel2);
        }
        tagPanel.add(textPanel);

        tagArea = new JTextArea();
        tagArea.setRows(3);
        JScrollPane tagScroller = new JScrollPane(tagArea);
        tagPanel.add(tagScroller);
    }
    return tagPanel;
}

From source file:edu.harvard.i2b2.query.QueryTopPanel.java

public void addPanel() {
    int rightmostPosition = dataModel.lastLabelPosition();
    JLabel label = new JLabel();
    label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    label.setText("and");
    label.setToolTipText("Click to change the relationship");
    label.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    label.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jAndOrLabelMouseClicked(evt);
        }// www  .  j ava 2s.  c  om
    });

    //jPanel1.add(label);
    //label.setBounds(rightmostPosition, 90, 30, 18);

    QueryConceptTreePanel panel = new QueryConceptTreePanel("Group " + (dataModel.getCurrentPanelCount() + 1),
            this);
    jPanel1.add(panel);
    panel.setBounds(rightmostPosition + 5, 0, 180, getParent().getHeight() - 100);
    jPanel1.setPreferredSize(new Dimension(rightmostPosition + 5 + 181, 150));
    jScrollPane4.setViewportView(jPanel1);

    dataModel.addPanel(panel, null, rightmostPosition + 5 + 180);

    jScrollPane4.getHorizontalScrollBar().setValue(jScrollPane4.getHorizontalScrollBar().getMaximum());
    jScrollPane4.getHorizontalScrollBar().setUnitIncrement(40);
}

From source file:ca.sqlpower.wabit.swingui.chart.ChartPanel.java

/**
 * Subroutine of {@link #buildUI()}. Makes a chart type toggle button and
 * adds it to the button group.//from w w  w.ja  v a 2s . c  o m
 * 
 * @param caption
 *            The text to appear under the button
 * @param type
 *            The type of chart the buttons should select
 * @param icon
 *            The icon for the button
 * @param fontSize
 *            the font size for the toggle buttons. The default font size of
 *            the toggle buttons are different than the default font size of
 *            JButtons on some platforms. This value should be equal to the
 *            JButton font size. This is a float as deriving fonts with a size
 *            takes a float.
 * @return A button properly configured for the new-look Wabit toolbar.
 */
private JToggleButton makeChartTypeButton(String caption, ChartType type, Icon icon, float fontSize) {
    JToggleButton b = new JToggleButton(caption, icon);
    b.putClientProperty(CHART_TYPE_PROP_KEY, type);
    chartTypeButtonGroup.add(b);

    b.setVerticalTextPosition(SwingConstants.BOTTOM);
    b.setHorizontalTextPosition(SwingConstants.CENTER);

    // Removes button borders on OS X 10.5
    b.putClientProperty("JButton.buttonType", "toolbar");

    b.addActionListener(genericActionListener);

    b.setFont(b.getFont().deriveFont(fontSize));

    return b;
}

From source file:com.tiempometa.muestradatos.JMuestraDatos.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos");
    menuBar1 = new JMenuBar();
    menu1 = new JMenu();
    configMenuItem = new JMenuItem();
    importTagsMenuItem = new JMenuItem();
    exportTagsMenuItem = new JMenuItem();
    clearTagsMenuItem = new JMenuItem();
    exitMenuItem = new JMenuItem();
    menu3 = new JMenu();
    aboutUsMenuItem = new JMenuItem();
    configureJavaMenuItem = new JMenuItem();
    panel5 = new JPanel();
    panel3 = new JPanel();
    panel4 = new JPanel();
    tabbedPane1 = new JTabbedPane();
    panel2 = new JPanel();
    label9 = new JLabel();
    label10 = new JLabel();
    label3 = new JLabel();
    readerPortLabel = new JLabel();
    label11 = new JLabel();
    boxIpAddressLabel = new JLabel();
    label4 = new JLabel();
    readerStatusLabel = new JLabel();
    label12 = new JLabel();
    boxTypeLabel = new JLabel();
    label2 = new JLabel();
    rssiLevelLabel = new JLabel();
    label13 = new JLabel();
    preferredReaderLabel = new JLabel();
    label5 = new JLabel();
    regionLabel = new JLabel();
    label14 = new JLabel();
    preferredAntenaLabel = new JLabel();
    label6 = new JLabel();
    readPowerLabel = new JLabel();
    label7 = new JLabel();
    writePowerLevel = new JLabel();
    usbConnectButton = new JButton();
    boxConnectButton = new JButton();
    panel1 = new JPanel();
    verifyDataButton = new JButton();
    loadReadingsButton = new JButton();
    readTagButton = new JButton();
    countTagsButton = new JButton();
    programTagButton = new JButton();
    panel8 = new JPanel();
    setBoxTimeButton = new JButton();
    getBoxTimeButton = new JButton();
    label20 = new JLabel();
    label19 = new JLabel();
    systemTimeLabel = new JLabel();
    foxberryTimeLabel = new JLabel();
    foxberryTimeDiffLabel = new JLabel();
    panel6 = new JPanel();
    label21 = new JLabel();
    label1 = new JLabel();
    usbStatusLabel = new JLabel();
    label16 = new JLabel();
    tcpStatusLabel = new JLabel();
    label8 = new JLabel();
    databaseLabel = new JLabel();
    panel7 = new JPanel();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle(bundle.getString("JMuestraDatos.this.title"));
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    setIconImage(/*from   ww  w. j a va2 s. c o m*/
            new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png"))
                    .getImage());
    setResizable(false);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== menuBar1 ========
    {

        //======== menu1 ========
        {
            menu1.setText(bundle.getString("JMuestraDatos.menu1.text"));

            //---- configMenuItem ----
            configMenuItem.setText(bundle.getString("JMuestraDatos.configMenuItem.text"));
            configMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    configMenuItemActionPerformed(e);
                }
            });
            menu1.add(configMenuItem);

            //---- importTagsMenuItem ----
            importTagsMenuItem.setText(bundle.getString("JMuestraDatos.importTagsMenuItem.text"));
            importTagsMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    importTagsMenuItemActionPerformed(e);
                }
            });
            menu1.add(importTagsMenuItem);

            //---- exportTagsMenuItem ----
            exportTagsMenuItem.setText(bundle.getString("JMuestraDatos.exportTagsMenuItem.text"));
            exportTagsMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    exportTagsMenuItemActionPerformed(e);
                }
            });
            menu1.add(exportTagsMenuItem);

            //---- clearTagsMenuItem ----
            clearTagsMenuItem.setText(bundle.getString("JMuestraDatos.clearTagsMenuItem.text"));
            clearTagsMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    clearTagsMenuItemActionPerformed(e);
                }
            });
            menu1.add(clearTagsMenuItem);
            menu1.addSeparator();

            //---- exitMenuItem ----
            exitMenuItem.setText(bundle.getString("JMuestraDatos.exitMenuItem.text"));
            exitMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem2ActionPerformed(e);
                }
            });
            menu1.add(exitMenuItem);
        }
        menuBar1.add(menu1);

        //======== menu3 ========
        {
            menu3.setText(bundle.getString("JMuestraDatos.menu3.text"));

            //---- aboutUsMenuItem ----
            aboutUsMenuItem.setText(bundle.getString("JMuestraDatos.aboutUsMenuItem.text"));
            aboutUsMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    aboutUsMenuItemActionPerformed(e);
                }
            });
            menu3.add(aboutUsMenuItem);

            //---- configureJavaMenuItem ----
            configureJavaMenuItem.setText(bundle.getString("JMuestraDatos.configureJavaMenuItem.text"));
            configureJavaMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    configureJavaMenuItemActionPerformed(e);
                }
            });
            menu3.add(configureJavaMenuItem);
        }
        menuBar1.add(menu3);
    }
    setJMenuBar(menuBar1);

    //======== panel5 ========
    {
        panel5.setLayout(new FormLayout(
                new ColumnSpec[] { new ColumnSpec(Sizes.dluX(18)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        new ColumnSpec(Sizes.dluX(343)) },
                new RowSpec[] { new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC,
                        new RowSpec(Sizes.dluY(17)) }));
    }
    contentPane.add(panel5, BorderLayout.NORTH);

    //======== panel3 ========
    {
        panel3.setLayout(new FormLayout(
                new ColumnSpec[] { new ColumnSpec(Sizes.dluX(16)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC },
                new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC }));
    }
    contentPane.add(panel3, BorderLayout.WEST);

    //======== panel4 ========
    {
        panel4.setLayout(
                new FormLayout(
                        new ColumnSpec[] { new ColumnSpec(Sizes.dluX(410)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC },
                        RowSpec.decodeSpecs("245dlu")));

        //======== tabbedPane1 ========
        {
            tabbedPane1.setFont(new Font("Tahoma", Font.BOLD, 16));

            //======== panel2 ========
            {
                panel2.setLayout(new FormLayout(
                        new ColumnSpec[] { new ColumnSpec(Sizes.dluX(25)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(89)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(73)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(17)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(84)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(80)) },
                        new RowSpec[] { new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                new RowSpec(Sizes.DLUY8) }));

                //---- label9 ----
                label9.setText(bundle.getString("JMuestraDatos.label9.text"));
                label9.setFont(new Font("Tahoma", Font.BOLD, 16));
                label9.setIcon(new ImageIcon(getClass().getResource("/com/tiempometa/resources/usb_128.png")));
                label9.setHorizontalAlignment(SwingConstants.CENTER);
                panel2.add(label9, cc.xywh(3, 3, 3, 1));

                //---- label10 ----
                label10.setText(bundle.getString("JMuestraDatos.label10.text"));
                label10.setFont(new Font("Tahoma", Font.BOLD, 16));
                label10.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/briefcase_128.png")));
                label10.setHorizontalAlignment(SwingConstants.CENTER);
                panel2.add(label10, cc.xywh(9, 3, 3, 1));

                //---- label3 ----
                label3.setText(bundle.getString("JMuestraDatos.label3.text"));
                label3.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label3, cc.xy(3, 5));

                //---- readerPortLabel ----
                readerPortLabel.setText(bundle.getString("JMuestraDatos.readerPortLabel.text"));
                panel2.add(readerPortLabel, cc.xy(5, 5));

                //---- label11 ----
                label11.setText(bundle.getString("JMuestraDatos.label11.text"));
                label11.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label11, cc.xy(9, 5));

                //---- boxIpAddressLabel ----
                boxIpAddressLabel.setText(bundle.getString("JMuestraDatos.boxIpAddressLabel.text"));
                panel2.add(boxIpAddressLabel, cc.xy(11, 5));

                //---- label4 ----
                label4.setText(bundle.getString("JMuestraDatos.label4.text"));
                label4.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label4, cc.xy(3, 7));

                //---- readerStatusLabel ----
                readerStatusLabel.setText(bundle.getString("JMuestraDatos.readerStatusLabel.text"));
                panel2.add(readerStatusLabel, cc.xy(5, 7));

                //---- label12 ----
                label12.setText(bundle.getString("JMuestraDatos.label12.text"));
                label12.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label12, cc.xy(9, 7));

                //---- boxTypeLabel ----
                boxTypeLabel.setText(bundle.getString("JMuestraDatos.boxTypeLabel.text"));
                panel2.add(boxTypeLabel, cc.xy(11, 7));

                //---- label2 ----
                label2.setText(bundle.getString("JMuestraDatos.label2.text"));
                label2.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label2, cc.xy(3, 9));

                //---- rssiLevelLabel ----
                rssiLevelLabel.setText(bundle.getString("JMuestraDatos.rssiLevelLabel.text"));
                panel2.add(rssiLevelLabel, cc.xy(5, 9));

                //---- label13 ----
                label13.setText(bundle.getString("JMuestraDatos.label13.text"));
                label13.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label13, cc.xy(9, 9));

                //---- preferredReaderLabel ----
                preferredReaderLabel.setText(bundle.getString("JMuestraDatos.preferredReaderLabel.text"));
                panel2.add(preferredReaderLabel, cc.xy(11, 9));

                //---- label5 ----
                label5.setText(bundle.getString("JMuestraDatos.label5.text"));
                label5.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label5, cc.xy(3, 11));

                //---- regionLabel ----
                regionLabel.setText(bundle.getString("JMuestraDatos.regionLabel.text"));
                panel2.add(regionLabel, cc.xy(5, 11));

                //---- label14 ----
                label14.setText(bundle.getString("JMuestraDatos.label14.text"));
                label14.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label14, cc.xy(9, 11));

                //---- preferredAntenaLabel ----
                preferredAntenaLabel.setText(bundle.getString("JMuestraDatos.preferredAntenaLabel.text"));
                panel2.add(preferredAntenaLabel, cc.xy(11, 11));

                //---- label6 ----
                label6.setText(bundle.getString("JMuestraDatos.label6.text"));
                label6.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label6, cc.xy(3, 13));

                //---- readPowerLabel ----
                readPowerLabel.setText(bundle.getString("JMuestraDatos.readPowerLabel.text"));
                panel2.add(readPowerLabel, cc.xy(5, 13));

                //---- label7 ----
                label7.setText(bundle.getString("JMuestraDatos.label7.text"));
                label7.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel2.add(label7, cc.xy(3, 15));

                //---- writePowerLevel ----
                writePowerLevel.setText(bundle.getString("JMuestraDatos.writePowerLevel.text"));
                panel2.add(writePowerLevel, cc.xy(5, 15));

                //---- usbConnectButton ----
                usbConnectButton.setText(bundle.getString("JMuestraDatos.usbConnectButton.text"));
                usbConnectButton.setFont(new Font("Tahoma", Font.BOLD, 14));
                usbConnectButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        usbConnectButtonActionPerformed(e);
                    }
                });
                panel2.add(usbConnectButton, cc.xywh(3, 17, 3, 1));

                //---- boxConnectButton ----
                boxConnectButton.setText(bundle.getString("JMuestraDatos.boxConnectButton.text"));
                boxConnectButton.setFont(new Font("Tahoma", Font.BOLD, 14));
                boxConnectButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        boxConnectButtonActionPerformed(e);
                    }
                });
                panel2.add(boxConnectButton, cc.xywh(9, 17, 3, 1));
            }
            tabbedPane1.addTab(bundle.getString("JMuestraDatos.panel2.tab.title"), panel2);

            //======== panel1 ========
            {
                panel1.setLayout(new FormLayout(
                        new ColumnSpec[] { new ColumnSpec(Sizes.dluX(35)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(120)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(47)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(130)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(28)) },
                        new RowSpec[] { new RowSpec(Sizes.dluY(15)), FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC }));

                //---- verifyDataButton ----
                verifyDataButton.setText(bundle.getString("JMuestraDatos.verifyDataButton.text"));
                verifyDataButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/check_64.png")));
                verifyDataButton.setHorizontalAlignment(SwingConstants.LEFT);
                verifyDataButton.setRolloverIcon(null);
                verifyDataButton.setPressedIcon(null);
                verifyDataButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                verifyDataButton.setEnabled(false);
                verifyDataButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        verifyDataButtonActionPerformed(e);
                    }
                });
                panel1.add(verifyDataButton, cc.xywh(3, 3, 3, 1));

                //---- loadReadingsButton ----
                loadReadingsButton.setText(bundle.getString("JMuestraDatos.loadReadingsButton.text"));
                loadReadingsButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/load_64.png")));
                loadReadingsButton.setHorizontalAlignment(SwingConstants.LEFT);
                loadReadingsButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                loadReadingsButton.setEnabled(false);
                loadReadingsButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        loadReadingsButtonActionPerformed(e);
                    }
                });
                panel1.add(loadReadingsButton, cc.xywh(7, 3, 3, 1));

                //---- readTagButton ----
                readTagButton.setText(bundle.getString("JMuestraDatos.readTagButton.text"));
                readTagButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/scan_64.png")));
                readTagButton.setHorizontalAlignment(SwingConstants.LEFT);
                readTagButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                readTagButton.setEnabled(false);
                readTagButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        readTagButtonActionPerformed(e);
                    }
                });
                panel1.add(readTagButton, cc.xywh(3, 5, 3, 1));

                //---- countTagsButton ----
                countTagsButton.setText(bundle.getString("JMuestraDatos.countTagsButton.text"));
                countTagsButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/counter_64.png")));
                countTagsButton.setHorizontalAlignment(SwingConstants.LEFT);
                countTagsButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                countTagsButton.setEnabled(false);
                countTagsButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        countTagsButtonActionPerformed(e);
                    }
                });
                panel1.add(countTagsButton, cc.xywh(7, 5, 3, 1));

                //---- programTagButton ----
                programTagButton.setText(bundle.getString("JMuestraDatos.programTagButton.text"));
                programTagButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/record_64.png")));
                programTagButton.setHorizontalAlignment(SwingConstants.LEFT);
                programTagButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                programTagButton.setEnabled(false);
                programTagButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        programTagButtonActionPerformed(e);
                    }
                });
                panel1.add(programTagButton, cc.xywh(3, 7, 3, 1));
            }
            tabbedPane1.addTab(bundle.getString("JMuestraDatos.panel1.tab.title"), panel1);

            //======== panel8 ========
            {
                panel8.setLayout(new FormLayout(
                        new ColumnSpec[] { new ColumnSpec(Sizes.dluX(35)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(160)),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(160)) },
                        new RowSpec[] { new RowSpec(Sizes.dluY(15)), FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC }));

                //---- setBoxTimeButton ----
                setBoxTimeButton.setText(bundle.getString("JMuestraDatos.setBoxTimeButton.text"));
                setBoxTimeButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/set_time_64.png")));
                setBoxTimeButton.setHorizontalAlignment(SwingConstants.LEFT);
                setBoxTimeButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                setBoxTimeButton.setEnabled(false);
                setBoxTimeButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        setBoxTimeButtonActionPerformed(e);
                    }
                });
                panel8.add(setBoxTimeButton, cc.xy(3, 3));

                //---- getBoxTimeButton ----
                getBoxTimeButton.setText(bundle.getString("JMuestraDatos.getBoxTimeButton.text"));
                getBoxTimeButton.setIcon(
                        new ImageIcon(getClass().getResource("/com/tiempometa/resources/get_time_64.png")));
                getBoxTimeButton.setHorizontalAlignment(SwingConstants.LEFT);
                getBoxTimeButton.setFont(new Font("Tahoma", Font.BOLD, 16));
                getBoxTimeButton.setEnabled(false);
                getBoxTimeButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        getBoxTimeButtonActionPerformed(e);
                    }
                });
                panel8.add(getBoxTimeButton, cc.xy(5, 3));

                //---- label20 ----
                label20.setText(bundle.getString("JMuestraDatos.label20.text"));
                label20.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel8.add(label20, cc.xy(3, 5));

                //---- label19 ----
                label19.setText(bundle.getString("JMuestraDatos.label19.text"));
                label19.setFont(new Font("Tahoma", Font.BOLD, 14));
                panel8.add(label19, cc.xy(5, 5));
                panel8.add(systemTimeLabel, cc.xy(3, 7));
                panel8.add(foxberryTimeLabel, cc.xy(5, 7));
                panel8.add(foxberryTimeDiffLabel, cc.xy(5, 9));
            }
            tabbedPane1.addTab(bundle.getString("JMuestraDatos.panel8.tab.title"), panel8);
        }
        panel4.add(tabbedPane1, cc.xy(1, 1));
    }
    contentPane.add(panel4, BorderLayout.CENTER);

    //======== panel6 ========
    {
        panel6.setLayout(new FormLayout(
                new ColumnSpec[] { new ColumnSpec(Sizes.dluX(17)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        new ColumnSpec(Sizes.dluX(65)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        new ColumnSpec(Sizes.dluX(65)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        new ColumnSpec(Sizes.dluX(199)) },
                new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(10)) }));

        //---- label21 ----
        label21.setText(bundle.getString("JMuestraDatos.label21.text"));
        label21.setFont(new Font("Tahoma", Font.BOLD, 16));
        panel6.add(label21, cc.xy(3, 1));

        //---- label1 ----
        label1.setText(bundle.getString("JMuestraDatos.label1.text"));
        label1.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel6.add(label1, cc.xy(5, 1));

        //---- usbStatusLabel ----
        usbStatusLabel.setText(bundle.getString("JMuestraDatos.usbStatusLabel.text"));
        usbStatusLabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel6.add(usbStatusLabel, cc.xy(7, 1));

        //---- label16 ----
        label16.setText(bundle.getString("JMuestraDatos.label16.text"));
        label16.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel6.add(label16, cc.xy(9, 1));

        //---- tcpStatusLabel ----
        tcpStatusLabel.setText(bundle.getString("JMuestraDatos.tcpStatusLabel.text"));
        tcpStatusLabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel6.add(tcpStatusLabel, cc.xy(11, 1));

        //---- label8 ----
        label8.setText(bundle.getString("JMuestraDatos.label8.text"));
        label8.setFont(new Font("Tahoma", Font.BOLD, 16));
        panel6.add(label8, cc.xy(3, 3));

        //---- databaseLabel ----
        databaseLabel.setText(bundle.getString("JMuestraDatos.databaseLabel.text"));
        panel6.add(databaseLabel, cc.xywh(3, 5, 11, 1));
    }
    contentPane.add(panel6, BorderLayout.SOUTH);

    //======== panel7 ========
    {
        panel7.setLayout(new FormLayout(
                new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC },
                new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC }));
    }
    contentPane.add(panel7, BorderLayout.EAST);
    setSize(740, 620);
    setLocationRelativeTo(getOwner());
    // //GEN-END:initComponents
}

From source file:edu.ku.brc.specify.tasks.subpane.ESResultsTablePanel.java

/**
 * @param table//from   ww  w  .  j  a  va2 s. c om
 * @param model
 */
protected void autoResizeColWidth(final JTable table, final DefaultTableModel model) {
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table.setModel(model);

    int margin = 5;

    DefaultTableColumnModel colModel = (DefaultTableColumnModel) table.getColumnModel();

    int preferredWidthTotal = 0;
    int renderedWidthTotal = 0;
    int[] colWidths = new int[table.getColumnCount()];
    int[] strWidths = new int[table.getColumnCount()];
    for (int i = 0; i < table.getColumnCount(); i++) {
        int vColIndex = i;
        TableColumn col = colModel.getColumn(vColIndex);
        int width = 0;

        TableCellRenderer headerRenderer = col.getHeaderRenderer();
        if (headerRenderer instanceof JLabel) {
            ((JLabel) headerRenderer).setHorizontalAlignment(SwingConstants.CENTER);
        }

        // Get width of column header
        TableCellRenderer renderer = col.getCellRenderer();
        if (renderer == null) {
            renderer = table.getTableHeader().getDefaultRenderer();
        }

        Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, 0,
                0);

        width = comp.getPreferredSize().width;

        // Get maximum width of column data
        int strWidth = 0;
        boolean isString = model.getColumnClass(i) == String.class;
        for (int r = 0; r < table.getRowCount(); r++) {
            renderer = table.getCellRenderer(r, vColIndex);
            Object objVal = table.getValueAt(r, vColIndex);
            if (isString && objVal != null) {
                strWidth = Math.max(strWidth, ((String) objVal).length());
            }
            comp = renderer.getTableCellRendererComponent(table, objVal, false, false, r, vColIndex);
            width = Math.max(width, comp.getPreferredSize().width);
        }

        // Add margin
        width += 2 * margin;

        preferredWidthTotal += col.getPreferredWidth();
        colWidths[i] = width;
        strWidths[i] = strWidth;

        renderedWidthTotal += width;
    }

    if (renderedWidthTotal > preferredWidthTotal) {
        for (int i = 0; i < table.getColumnCount(); i++) {
            TableColumn col = colModel.getColumn(i);
            TableCellRenderer renderer = col.getCellRenderer();
            if (renderer != null) {
                ((JLabel) renderer).setHorizontalAlignment(
                        strWidths[i] > 20 ? SwingConstants.LEFT : SwingConstants.CENTER);
                //((JLabel)renderer).setHorizontalAlignment(SwingConstants.LEFT);
            }

            if (model.getColumnCount() > 3 && renderedWidthTotal > preferredWidthTotal) {
                col.setPreferredWidth(colWidths[i]);
            }
        }
    }

    ((DefaultTableCellRenderer) table.getTableHeader().getDefaultRenderer())
            .setHorizontalAlignment(SwingConstants.LEFT);

    // table.setAutoCreateRowSorter(true);
    table.getTableHeader().setReorderingAllowed(false);
}

From source file:com.all.login.view.NewAccountFormPanel.java

private JLabel getTitleLabel() {
    if (titleLabel == null) {
        titleLabel = new JLabel();
        titleLabel.setBounds(TITLE_LABEL_BOUNDS);
        titleLabel.setName(SynthFonts.BOLD_FONT28_PURPLE82_33_117);
        titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
    }/*from  ww  w  .  j  a v  a  2 s  .  co m*/
    return titleLabel;
}

From source file:de.tor.tribes.ui.views.DSWorkbenchAttackFrame.java

/**
 * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this
 * method is always regenerated by the Form Editor.
 *///www  . ja v  a 2s  . c o m
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    jxSearchPane = new org.jdesktop.swingx.JXPanel();
    jXPanel2 = new org.jdesktop.swingx.JXPanel();
    jButton12 = new javax.swing.JButton();
    jTextField1 = new javax.swing.JTextField();
    jLabel21 = new javax.swing.JLabel();
    jFilterRows = new javax.swing.JCheckBox();
    jFilterCaseSensitive = new javax.swing.JCheckBox();
    jScrollPane1 = new javax.swing.JScrollPane();
    jXColumnList = new org.jdesktop.swingx.JXList();
    jLabel22 = new javax.swing.JLabel();
    jXAttackPanel = new org.jdesktop.swingx.JXPanel();
    jAttackTabPane = new javax.swing.JTabbedPane();
    jNewPlanPanel = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jAttackPanel = new javax.swing.JPanel();
    jAttackFrameAlwaysOnTop = new javax.swing.JCheckBox();
    capabilityInfoPanel1 = new de.tor.tribes.ui.components.CapabilityInfoPanel();

    jxSearchPane.setOpaque(false);
    jxSearchPane.setLayout(new java.awt.GridBagLayout());

    jXPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    jXPanel2.setInheritAlpha(false);

    jButton12.setText("Anwenden");
    jButton12.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseReleased(java.awt.event.MouseEvent evt) {
            fireHideGlassPaneEvent(evt);
        }
    });

    jTextField1.addCaretListener(new javax.swing.event.CaretListener() {
        public void caretUpdate(javax.swing.event.CaretEvent evt) {
            fireHighlightEvent(evt);
        }
    });

    jLabel21.setText("Suchbegriff");

    jFilterRows.setText("Nur gefilterte Zeilen anzeigen");
    jFilterRows.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            fireUpdateFilterEvent(evt);
        }
    });

    jFilterCaseSensitive.setText("Gro-/Kleinschreibung beachten");
    jFilterCaseSensitive.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            fireUpdateFilterEvent(evt);
        }
    });

    jXColumnList.setModel(new javax.swing.AbstractListModel() {
        String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };

        public int getSize() {
            return strings.length;
        }

        public Object getElementAt(int i) {
            return strings[i];
        }
    });
    jXColumnList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    jScrollPane1.setViewportView(jXColumnList);

    jLabel22.setText("Spalten");

    javax.swing.GroupLayout jXPanel2Layout = new javax.swing.GroupLayout(jXPanel2);
    jXPanel2.setLayout(jXPanel2Layout);
    jXPanel2Layout
            .setHorizontalGroup(jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jXPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jXPanel2Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel22, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(
                                            jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addGap(18, 18, 18)
                                    .addGroup(jXPanel2Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(jXPanel2Layout.createSequentialGroup()
                                                    .addComponent(jScrollPane1,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 158,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(18, 18, 18)
                                                    .addGroup(jXPanel2Layout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.TRAILING)
                                                            .addGroup(jXPanel2Layout.createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.TRAILING,
                                                                    false)
                                                                    .addComponent(jFilterRows,
                                                                            javax.swing.GroupLayout.Alignment.LEADING,
                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                            Short.MAX_VALUE)
                                                                    .addComponent(jFilterCaseSensitive,
                                                                            javax.swing.GroupLayout.Alignment.LEADING,
                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                            Short.MAX_VALUE))
                                                            .addComponent(jButton12)))
                                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    355, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jXPanel2Layout.setVerticalGroup(jXPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jXPanel2Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel21)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jXPanel2Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jXPanel2Layout
                                            .createSequentialGroup().addComponent(jFilterCaseSensitive)
                                            .addPreferredGap(
                                                    javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addComponent(jFilterRows)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jButton12))
                                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 164,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel22))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    jxSearchPane.add(jXPanel2, new java.awt.GridBagConstraints());

    jXAttackPanel.setLayout(new java.awt.BorderLayout());
    jXAttackPanel.add(jAttackTabPane, java.awt.BorderLayout.CENTER);

    jNewPlanPanel.setOpaque(false);
    jNewPlanPanel.setLayout(new java.awt.BorderLayout());

    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/ui/document_new_24x24.png"))); // NOI18N
    jLabel1.setToolTipText("Leeren Plan erstellen");
    jLabel1.setEnabled(false);
    jLabel1.setMaximumSize(new java.awt.Dimension(40, 40));
    jLabel1.setMinimumSize(new java.awt.Dimension(40, 40));
    jLabel1.setPreferredSize(new java.awt.Dimension(40, 40));
    jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseEntered(java.awt.event.MouseEvent evt) {
            fireEnterEvent(evt);
        }

        public void mouseExited(java.awt.event.MouseEvent evt) {
            fireMouseExitEvent(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            fireCreateAttackPlanEvent(evt);
        }
    });
    jNewPlanPanel.add(jLabel1, java.awt.BorderLayout.CENTER);

    setTitle("Befehle");
    setMinimumSize(new java.awt.Dimension(700, 500));
    getContentPane().setLayout(new java.awt.GridBagLayout());

    jAttackPanel.setBackground(new java.awt.Color(239, 235, 223));
    jAttackPanel.setPreferredSize(new java.awt.Dimension(700, 500));
    jAttackPanel.setLayout(new java.awt.BorderLayout());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    getContentPane().add(jAttackPanel, gridBagConstraints);

    jAttackFrameAlwaysOnTop.setText("Immer im Vordergrund");
    jAttackFrameAlwaysOnTop.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            fireAttackFrameAlwaysOnTopEvent(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(jAttackFrameAlwaysOnTop, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(capabilityInfoPanel1, gridBagConstraints);

    pack();
}

From source file:com.sshtools.common.ui.SshToolsApplicationClientPanel.java

/**
 *
 *
 * @param profile/*from ww w. j a v  a2 s  .  co m*/
 *
 * @return
 */
public boolean editConnection(SshToolsConnectionProfile profile) {
    final SshToolsConnectionPanel panel = new SshToolsConnectionPanel(allowConnectionSettingsEditing());
    SshToolsConnectionTab[] tabs = getAdditionalConnectionTabs();

    for (int i = 0; (tabs != null) && (i < tabs.length); i++) {
        tabs[i].setConnectionProfile(profile);
        panel.addTab(tabs[i]);
    }

    panel.setConnectionProfile(profile);

    final Option ok = new Option("Ok", "Apply the settings and close this dialog", 'o');
    final Option cancel = new Option("Cancel", "Close this dialog without applying the settings", 'c');
    OptionCallback callback = new OptionCallback() {
        public boolean canClose(OptionsDialog dialog, Option option) {
            if (option == ok) {
                return panel.validateTabs();
            }

            return true;
        }
    };

    OptionsDialog od = OptionsDialog.createOptionDialog(SshToolsApplicationClientPanel.this,
            new Option[] { ok, cancel }, panel, "Connection Settings", ok, callback, null);
    od.pack();
    UIUtil.positionComponent(SwingConstants.CENTER, od);
    od.setVisible(true);

    if (od.getSelectedOption() == ok) {
        panel.applyTabs();

        if (profile == getCurrentConnectionProfile()) {
            setNeedSave(true);
        }

        return true;
    }

    return false;
}