Example usage for javax.swing SwingConstants RIGHT

List of usage examples for javax.swing SwingConstants RIGHT

Introduction

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

Prototype

int RIGHT

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

Click Source Link

Document

Box-orientation constant used to specify the right side of a box.

Usage

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java

/**
 * Formats the specified label.//from  w w  w  . j a  v a2s .  c  o m
 * 
 * @param label The label to format.
 */
private void formatLabel(JLabel label) {
    label.setHorizontalTextPosition(SwingConstants.LEADING);
    label.setAlignmentX(SwingConstants.RIGHT);
    label.setVisible(false);
}

From source file:org.openscience.jmol.app.Jmol.java

/**
 * This is the hook through which all menu items are
 * created.  It registers the result with the menuitem
 * hashtable so that it can be fetched with getMenuItem().
 * @param cmd//from w w  w  .ja  v a  2  s. c  o  m
 * @return Menu item created
 * @see #getMenuItem
 */
protected JMenuItem createMenuItem(String cmd) {

    JMenuItem mi;
    if (cmd.endsWith("Check")) {
        mi = guimap.newJCheckBoxMenuItem(cmd, false);
    } else {
        mi = guimap.newJMenuItem(cmd);
    }

    ImageIcon f = JmolResourceHandler.getIconX(cmd + "Image");
    if (f != null) {
        mi.setHorizontalTextPosition(SwingConstants.RIGHT);
        mi.setIcon(f);
    }

    if (cmd.endsWith("Script")) {
        mi.setActionCommand(JmolResourceHandler.getStringX(cmd));
        mi.addActionListener(executeScriptAction);
    } else {
        mi.setActionCommand(cmd);
        Action a = getAction(cmd);
        if (a != null) {
            mi.addActionListener(a);
            a.addPropertyChangeListener(new ActionChangedListener(mi));
            mi.setEnabled(a.isEnabled());
        } else {
            mi.setEnabled(false);
        }
    }
    menuItems.put(cmd, mi);
    return mi;
}

From source file:org.openscience.jmol.app.Jmol.java

/**
 * Create a menu for the app.  By default this pulls the
 * definition of the menu from the associated resource file.
 * @param key//from   w  ww  .  j a v  a2  s .  co m
 * @return Menu created
 */
protected JMenu createMenu(String key) {

    // Get list of items from resource file:
    String[] itemKeys = tokenize(JmolResourceHandler.getStringX(key));

    // Get label associated with this menu:
    JMenu menu = guimap.newJMenu(key);
    ImageIcon f = JmolResourceHandler.getIconX(key + "Image");
    if (f != null) {
        menu.setHorizontalTextPosition(SwingConstants.RIGHT);
        menu.setIcon(f);
    }

    // Loop over the items in this menu:
    for (int i = 0; i < itemKeys.length; i++) {

        String item = itemKeys[i];
        if (item.equals("-")) {
            menu.addSeparator();
            continue;
        }
        if (item.endsWith("Menu")) {
            JMenu pm;
            if ("recentFilesMenu".equals(item)) {
                /*recentFilesMenu = */pm = createMenu(item);
            } else {
                pm = createMenu(item);
            }
            menu.add(pm);
            continue;
        }
        JMenuItem mi = createMenuItem(item);
        menu.add(mi);
    }
    menu.addMenuListener(display.getMenuListener());
    return menu;
}

From source file:org.piraso.ui.base.ContextMonitorTopComponent.java

/** This method is called from within the constructor to
 * initialize the form./*ww w. j  a va 2  s . co m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    toolbar = new javax.swing.JToolBar();
    jSeparator2 = new javax.swing.JToolBar.Separator();
    btnSearch = new javax.swing.JToggleButton();
    btnClear = new javax.swing.JButton();
    jSeparator1 = new javax.swing.JToolBar.Separator();
    btnAutoScroll = new javax.swing.JToggleButton();
    cboUrl = new javax.swing.JComboBox();
    tableScrollPane = new javax.swing.JScrollPane();
    table = new javax.swing.JTable();
    searchBar = new javax.swing.JToolBar();
    jLabel1 = new javax.swing.JLabel();
    txtSearch = new javax.swing.JTextField();
    jSeparator3 = new javax.swing.JToolBar.Separator();
    btnPrevious = new javax.swing.JButton();
    btnNext = new javax.swing.JButton();
    jSeparator5 = new javax.swing.JToolBar.Separator();
    chkMatchCase = new javax.swing.JCheckBox();
    chkWholeWord = new javax.swing.JCheckBox();
    chkRegex = new javax.swing.JCheckBox();
    btnCloseSearchBar = new javax.swing.JButton();

    setLayout(new java.awt.BorderLayout());

    toolbar.setBackground(new java.awt.Color(226, 226, 226));
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.add(jSeparator2);

    btnSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/find.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnSearch, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnSearch.text")); // NOI18N
    btnSearch.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnSearch.toolTipText")); // NOI18N
    btnSearch.setFocusable(false);
    btnSearch.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnSearch.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnSearch.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnSearchActionPerformed(evt);
        }
    });
    toolbar.add(btnSearch);

    btnClear.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/edit_clear.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnClear, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnClear.text")); // NOI18N
    btnClear.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnClear.toolTipText")); // NOI18N
    btnClear.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 7, 7, 7));
    btnClear.setFocusable(false);
    btnClear.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnClear.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnClear.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnClearActionPerformed(evt);
        }
    });
    toolbar.add(btnClear);
    toolbar.add(jSeparator1);

    btnAutoScroll.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/org/piraso/ui/base/icons/arrow-switch-270.png"))); // NOI18N
    btnAutoScroll.setSelected(true);
    org.openide.awt.Mnemonics.setLocalizedText(btnAutoScroll, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnAutoScroll.text")); // NOI18N
    btnAutoScroll.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnAutoScroll.toolTipText")); // NOI18N
    btnAutoScroll.setFocusable(false);
    btnAutoScroll.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnAutoScroll.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnAutoScroll.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnAutoScrollActionPerformed(evt);
        }
    });
    toolbar.add(btnAutoScroll);

    cboUrl.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N
    cboUrl.setModel(comboBoxModel);
    toolbar.add(cboUrl);

    add(toolbar, java.awt.BorderLayout.NORTH);

    tableScrollPane.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    tableScrollPane.setFont(new java.awt.Font("Monospaced", 0, 10)); // NOI18N

    table.setFont(FontProviderManager.INSTANCE.getEditorDefaultFont());
    table.setModel(tableModel);
    table.setGridColor(new java.awt.Color(204, 0, 0));
    table.setRowMargin(0);
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    tableScrollPane.setViewportView(table);

    add(tableScrollPane, java.awt.BorderLayout.CENTER);

    searchBar.setBackground(new java.awt.Color(226, 226, 226));
    searchBar.setFloatable(false);
    searchBar.setRollover(true);
    searchBar.setVisible(false);

    org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.jLabel1.text")); // NOI18N
    searchBar.add(jLabel1);

    txtSearch.setText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.txtSearch.text")); // NOI18N
    txtSearch.setMaximumSize(new java.awt.Dimension(200, 2147483647));
    txtSearch.setPreferredSize(new java.awt.Dimension(200, 28));
    searchBar.add(txtSearch);
    searchBar.add(jSeparator3);

    btnPrevious.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/previous.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnPrevious, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnPrevious.text")); // NOI18N
    btnPrevious.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnPrevious.toolTipText")); // NOI18N
    btnPrevious.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 7, 7, 7));
    btnPrevious.setFocusable(false);
    btnPrevious.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnPrevious.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnPrevious.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnPreviousActionPerformed(evt);
        }
    });
    searchBar.add(btnPrevious);

    btnNext.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/next.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnNext, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnNext.text")); // NOI18N
    btnNext.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnNext.toolTipText")); // NOI18N
    btnNext.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 7, 7, 7));
    btnNext.setFocusable(false);
    btnNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnNext.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnNext.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnNextActionPerformed(evt);
        }
    });
    searchBar.add(btnNext);
    searchBar.add(jSeparator5);

    chkMatchCase.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(chkMatchCase, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.chkMatchCase.text")); // NOI18N
    chkMatchCase.setContentAreaFilled(false);
    chkMatchCase.setFocusable(false);
    chkMatchCase.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    searchBar.add(chkMatchCase);

    chkWholeWord.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(chkWholeWord, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.chkWholeWord.text")); // NOI18N
    chkWholeWord.setContentAreaFilled(false);
    chkWholeWord.setFocusable(false);
    chkWholeWord.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    searchBar.add(chkWholeWord);

    chkRegex.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(chkRegex, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.chkRegex.text")); // NOI18N
    chkRegex.setContentAreaFilled(false);
    chkRegex.setFocusable(false);
    chkRegex.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    searchBar.add(chkRegex);

    btnCloseSearchBar
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/close.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnCloseSearchBar, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnCloseSearchBar.text")); // NOI18N
    btnCloseSearchBar.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnCloseSearchBar.toolTipText")); // NOI18N
    btnCloseSearchBar.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 2, 7, 2));
    btnCloseSearchBar.setFocusable(false);
    btnCloseSearchBar.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    btnCloseSearchBar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    btnCloseSearchBar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnCloseSearchBar.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnCloseSearchBarActionPerformed(evt);
        }
    });
    searchBar.add(Box.createHorizontalGlue());
    searchBar.add(btnCloseSearchBar);

    add(searchBar, java.awt.BorderLayout.PAGE_END);
}

From source file:org.piraso.ui.sql.SQLViewTopComponent.java

private void initTable() {
    TableColumn numColumn = table.getColumnModel().getColumn(0);
    TableColumn methodColumn = table.getColumnModel().getColumn(1);
    TableColumn typeColumn = table.getColumnModel().getColumn(2);
    TableColumn valueColumn = table.getColumnModel().getColumn(3);

    numColumn.setHeaderValue("");
    numColumn.setMaxWidth(30);//from  w  ww. ja v a 2s .  c o  m
    numColumn.setCellRenderer(new AlignableTableCellRendererImpl(SwingConstants.RIGHT, false, true));

    methodColumn.setHeaderValue("Method");
    methodColumn.setPreferredWidth(300);

    typeColumn.setHeaderValue("Type");
    typeColumn.setPreferredWidth(200);

    valueColumn.setHeaderValue("Value");
    valueColumn.setPreferredWidth(200);
}

From source file:org.sonarlint.intellij.config.global.SonarQubeServerEditor.java

@Nullable
@Override/*from www.  j a  v  a  2s.c  om*/
protected JComponent createCenterPanel() {
    nameLabel = new JBLabel("Name:", SwingConstants.RIGHT);
    nameLabel.setDisplayedMnemonic('N');
    nameText = new JBTextField();
    nameText.setDocument(new LengthRestrictedDocument(NAME_MAX_LENGTH));
    nameText.setText(server.getName());
    if (!isCreating) {
        nameText.setFont(nameText.getFont().deriveFont(Font.BOLD));
    }
    nameText.setEditable(isCreating);
    nameLabel.setLabelFor(nameText);

    urlLabel = new JBLabel("Server URL:", SwingConstants.RIGHT);
    urlLabel.setDisplayedMnemonic('U');
    urlText = new JBTextField();
    urlText.setDocument(new PlainDocument());
    urlText.setText(server.getHostUrl());
    urlText.getEmptyText().setText("Example: http://localhost:9000");
    urlLabel.setLabelFor(urlText);

    authTypeLabel = new JBLabel("Authentication type:", SwingConstants.RIGHT);

    authTypeComboBox = new ComboBox();
    authTypeComboBox.addItem(AUTH_TOKEN);
    authTypeComboBox.addItem(AUTH_PASSWORD);

    loginLabel = new JBLabel("Login:", SwingConstants.RIGHT);
    loginLabel.setDisplayedMnemonic('L');
    loginText = new JBTextField();
    loginText.setDocument(new PlainDocument());
    loginText.setText(server.getLogin());
    loginText.getEmptyText().setText("");
    loginLabel.setLabelFor(loginText);

    passwordLabel = new JBLabel("Password:", SwingConstants.RIGHT);
    passwordText = new JBPasswordField();
    passwordText.setDocument(new PlainDocument());
    passwordText.setText(server.getPassword());
    passwordText.getEmptyText().setText("");
    passwordLabel.setLabelFor(passwordText);

    tokenLabel = new JBLabel("Token:", SwingConstants.RIGHT);
    tokenText = new JBPasswordField();
    tokenText.setDocument(new PlainDocument());
    tokenText.setColumns(TEXT_COLUMNS);
    tokenText.setText(server.getToken());
    tokenText.getEmptyText().setText("");
    tokenLabel.setLabelFor(tokenText);

    tokenButton = new JButton("Create token");
    tokenButton.addActionListener(evt -> generateToken());
    tokenButton.setToolTipText(
            "Opens a web browser, pointing to the user security page in the configured SonarQube server");

    proxySettingsButton = new JButton("Proxy settings");
    enableProxy = new JBCheckBox("Use proxy", server.enableProxy());
    enableProxy.setMnemonic('y');

    enableProxy.setEnabled(HttpConfigurable.getInstance().USE_HTTP_PROXY);

    testButton = new JButton("Test connection");
    testButton.setFont(testButton.getFont().deriveFont(Font.BOLD));
    testButton.addActionListener(evt -> testConnection());
    rootPanel = new JPanel(new GridBagLayout());
    proxySettingsButton.addActionListener(evt -> {
        HttpConfigurable.editConfigurable(rootPanel);
        enableProxy.setEnabled(HttpConfigurable.getInstance().USE_HTTP_PROXY);
    });

    createRootPanel();

    if (server.getLogin() != null) {
        authTypeComboBox.setSelectedItem(AUTH_PASSWORD);
        switchAuth(false);
    } else {
        authTypeComboBox.setSelectedItem(AUTH_TOKEN);
        switchAuth(true);
    }

    authTypeComboBox.addItemListener(e -> switchAuth(e.getItem().equals(AUTH_TOKEN)));
    setIcon();

    return rootPanel;
}

From source file:org.springframework.richclient.layout.GridBagLayoutBuilder.java

/**
 * Appends a label and field to the end of the current line.<p />
 *
 * The label will be to the left of the field, and be right-justified.<br />
 * The field will "grow" horizontally as space allows.<p />
 *
 * @param label   the label to associate and layout with the field
 * @param colSpan the number of columns the field should span
 *
 * @return "this" to make it easier to string together append calls
 *///w w  w.  j  a  v a2s  .c  om
public GridBagLayoutBuilder appendLabeledField(final JLabel label, final JComponent field,
        LabelOrientation labelOrientation, int colSpan, int rowSpan, boolean expandX, boolean expandY) {
    label.setLabelFor(field);

    final int col = getCurrentCol();
    final int row = getCurrentRow();
    final Insets insets = getDefaultInsets();

    if (labelOrientation == LabelOrientation.LEFT || labelOrientation == null) {
        label.setHorizontalAlignment(SwingConstants.RIGHT);
        append(label, col, row, 1, 1, false, expandY, insets);
        append(field, col + 1, row, colSpan, rowSpan, expandX, expandY, insets);
    } else if (labelOrientation == LabelOrientation.RIGHT) {
        label.setHorizontalAlignment(SwingConstants.LEFT);
        append(field, col, row, colSpan, rowSpan, expandX, expandY, insets);
        append(label, col + colSpan, row, 1, rowSpan, false, expandY, insets);
    } else if (labelOrientation == LabelOrientation.TOP) {
        label.setHorizontalAlignment(SwingConstants.LEFT);
        append(label, col, row, colSpan, 1, expandX, false, insets);
        append(field, col, row + 1, colSpan, rowSpan, expandX, expandY, insets);
    } else if (labelOrientation == LabelOrientation.BOTTOM) {
        label.setHorizontalAlignment(SwingConstants.LEFT);
        append(field, col, row, colSpan, rowSpan, expandX, expandY, insets);
        append(label, col, row + rowSpan, colSpan, 1, expandX, false, insets);
    }

    return this;
}

From source file:org.springframework.richclient.layout.GridBagLayoutBuilder.java

/**
 * Appends a right-justified label to the end of the given line, using the
 * provided string as the key to look in the
 * {@link #setComponentFactory(ComponentFactory) ComponentFactory's}message
 * bundle for the text to use./*from w w w .  j  av  a  2  s. c om*/
 *
 * @param labelKey the key into the message bundle; if not found the key is used
 *                 as the text to display
 * @param colSpan  the number of columns to span
 *
 * @return "this" to make it easier to string together append calls
 */
public GridBagLayoutBuilder appendRightLabel(String labelKey, int colSpan) {
    final JLabel label = createLabel(labelKey);
    label.setHorizontalAlignment(SwingConstants.RIGHT);
    return appendLabel(label, colSpan);
}

From source file:org.yccheok.jstock.gui.IndicatorScannerJPanel.java

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

    jPanel1 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jPanel2 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();

    setLayout(new java.awt.BorderLayout(5, 5));

    jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/player_play.png"))); // NOI18N
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui"); // NOI18N
    jButton1.setText(bundle.getString("IndicatorScannerJPanel_Scan...")); // NOI18N
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });
    jPanel1.add(jButton1);

    jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/stop.png"))); // NOI18N
    jButton2.setText(bundle.getString("IndicatorScannerJPanel_Stop")); // NOI18N
    jButton2.setEnabled(false);
    jButton2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton2ActionPerformed(evt);
        }
    });
    jPanel1.add(jButton2);

    add(jPanel1, java.awt.BorderLayout.SOUTH);

    jPanel2.setBorder(javax.swing.BorderFactory
            .createTitledBorder(bundle.getString("IndicatorScannerJPanel_IndicatorScanResult"))); // NOI18N
    jPanel2.setLayout(new java.awt.BorderLayout());

    jTable1.setAutoCreateRowSorter(true);
    jTable1.setFont(jTable1.getFont().deriveFont(jTable1.getFont().getStyle() | java.awt.Font.BOLD,
            jTable1.getFont().getSize() + 1));
    jTable1.setModel(new IndicatorTableModel());
    jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
    this.jTable1.setDefaultRenderer(Number.class, new StockTableCellRenderer(SwingConstants.RIGHT));
    this.jTable1.setDefaultRenderer(Double.class, new StockTableCellRenderer(SwingConstants.RIGHT));
    this.jTable1.setDefaultRenderer(Object.class, new StockTableCellRenderer(SwingConstants.LEFT));

    this.jTable1.getTableHeader().addMouseListener(new TableColumnSelectionPopupListener(2));
    this.jTable1.addMouseListener(new TableRowPopupListener());
    this.jTable1.addKeyListener(new TableKeyEventListener());

    if (JStock.instance().getJStockOptions().useLargeFont()) {
        this.jTable1.setRowHeight((int) (this.jTable1.getRowHeight() * Constants.FONT_ENLARGE_FACTOR));
    }
    jScrollPane1.setViewportView(jTable1);

    jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER);

    add(jPanel2, java.awt.BorderLayout.CENTER);
}

From source file:org.yccheok.jstock.gui.JStock.java

/** This method is called from within the constructor to
 * initialize the form./*from  w w  w  .ja va2  s .c om*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    buttonGroup1 = new javax.swing.ButtonGroup();
    buttonGroup2 = new javax.swing.ButtonGroup();
    buttonGroup3 = new javax.swing.ButtonGroup();
    buttonGroup4 = new javax.swing.ButtonGroup();
    jComboBox1 = new AutoCompleteJComboBox();
    jPanel6 = new javax.swing.JPanel();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel8 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jPanel10 = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jMenuBar2 = new javax.swing.JMenuBar();
    jMenu3 = new javax.swing.JMenu();
    jMenuItem2 = new javax.swing.JMenuItem();
    jMenuItem9 = new javax.swing.JMenuItem();
    jSeparator7 = new javax.swing.JPopupMenu.Separator();
    jMenuItem11 = new javax.swing.JMenuItem();
    jMenuItem10 = new javax.swing.JMenuItem();
    jSeparator8 = new javax.swing.JPopupMenu.Separator();
    jMenuItem1 = new javax.swing.JMenuItem();
    jMenu5 = new javax.swing.JMenu();
    jMenuItem4 = new javax.swing.JMenuItem();
    jMenuItem7 = new javax.swing.JMenuItem();
    jSeparator4 = new javax.swing.JPopupMenu.Separator();
    jMenuItem15 = new javax.swing.JMenuItem();
    jMenu6 = new javax.swing.JMenu();
    jMenu10 = new javax.swing.JMenu();
    jRadioButtonMenuItem1 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem2 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem4 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem6 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem3 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem5 = new javax.swing.JRadioButtonMenuItem();
    jMenu7 = new javax.swing.JMenu();
    jMenuItem8 = new javax.swing.JMenuItem();
    jMenu9 = new javax.swing.JMenu();
    jMenu8 = new javax.swing.JMenu();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem6 = new javax.swing.JMenuItem();
    jMenu4 = new javax.swing.JMenu();
    jMenu2 = new javax.swing.JMenu();
    jMenuItem3 = new javax.swing.JMenuItem();
    jMenuItem16 = new javax.swing.JMenuItem();
    jMenuItem12 = new javax.swing.JMenuItem();
    jSeparator6 = new javax.swing.JPopupMenu.Separator();
    jMenuItem13 = new javax.swing.JMenuItem();
    jMenuItem14 = new javax.swing.JMenuItem();
    jSeparator5 = new javax.swing.JPopupMenu.Separator();
    jMenuItem5 = new javax.swing.JMenuItem();
    jMenu11 = new javax.swing.JMenu();
    jMenuItem17 = new javax.swing.JMenuItem();

    jComboBox1.setEditable(true);
    jComboBox1.setPreferredSize(new java.awt.Dimension(150, 24));
    ((AutoCompleteJComboBox) this.jComboBox1).attachStockInfoObserver(getStockInfoObserver());
    ((AutoCompleteJComboBox) this.jComboBox1).attachDispObserver(getDispObserver());

    setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui"); // NOI18N
    setTitle(bundle.getString("MainFrame_Application_Title")); // NOI18N
    setIconImage(getMyIconImage());
    addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            formMouseClicked(evt);
        }
    });
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
            formWindowClosed(evt);
        }

        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }

        public void windowDeiconified(java.awt.event.WindowEvent evt) {
            formWindowDeiconified(evt);
        }

        public void windowIconified(java.awt.event.WindowEvent evt) {
            formWindowIconified(evt);
        }
    });
    getContentPane().setLayout(new java.awt.BorderLayout(5, 5));

    jPanel6.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    jPanel6.setLayout(new java.awt.BorderLayout(5, 5));
    this.jPanel6.add(statusBar, java.awt.BorderLayout.SOUTH);
    getContentPane().add(jPanel6, java.awt.BorderLayout.SOUTH);

    jTabbedPane1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            jTabbedPane1StateChanged(evt);
        }
    });

    jPanel8.setLayout(new java.awt.BorderLayout(5, 5));

    jTable1.setAutoCreateRowSorter(true);
    jTable1.setFont(jTable1.getFont().deriveFont(jTable1.getFont().getStyle() | java.awt.Font.BOLD,
            jTable1.getFont().getSize() + 1));
    jTable1.setModel(new StockTableModel());
    jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
    this.jTable1.setDefaultRenderer(Number.class, new StockTableCellRenderer(SwingConstants.RIGHT));
    this.jTable1.setDefaultRenderer(Double.class, new StockTableCellRenderer(SwingConstants.RIGHT));
    this.jTable1.setDefaultRenderer(Object.class, new StockTableCellRenderer(SwingConstants.LEFT));

    this.jTable1.setDefaultEditor(Double.class, new NonNegativeDoubleEditor());

    this.jTable1.getModel().addTableModelListener(this.getTableModelListener());

    this.jTable1.getTableHeader().addMouseListener(new TableColumnSelectionPopupListener(1));
    this.jTable1.addMouseListener(new TableMouseAdapter());
    this.jTable1.addKeyListener(new TableKeyEventListener());

    if (jStockOptions.useLargeFont()) {
        this.jTable1.setRowHeight((int) (this.jTable1.getRowHeight() * Constants.FONT_ENLARGE_FACTOR));
    }
    jTable1.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            jTable1KeyPressed(evt);
        }
    });
    jScrollPane1.setViewportView(jTable1);

    jPanel8.add(jScrollPane1, java.awt.BorderLayout.CENTER);

    jLabel1.setText(bundle.getString("MainFrame_Stock")); // NOI18N
    jPanel1.add(jLabel1);

    jPanel8.add(jPanel1, java.awt.BorderLayout.NORTH);

    jPanel10.setPreferredSize(new java.awt.Dimension(328, 170));
    jPanel10.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 10, 5));

    jPanel3.setBackground(new java.awt.Color(255, 255, 255));
    jPanel3.setPreferredSize(new java.awt.Dimension(170, 160));
    jPanel3.setBorder(new org.jdesktop.swingx.border.DropShadowBorder(true));
    jPanel3.setLayout(new java.awt.BorderLayout());
    jPanel10.add(jPanel3);
    EMPTY_DYNAMIC_CHART.getChartPanel().addMouseListener(dynamicChartMouseAdapter);
    jPanel3.add(EMPTY_DYNAMIC_CHART.getChartPanel(), java.awt.BorderLayout.CENTER);

    jPanel8.add(jPanel10, java.awt.BorderLayout.SOUTH);

    jTabbedPane1.addTab(bundle.getString("MainFrame_Title"), jPanel8); // NOI18N

    getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER);

    jPanel2.setLayout(new java.awt.GridLayout(2, 1));
    getContentPane().add(jPanel2, java.awt.BorderLayout.NORTH);

    jMenu3.setText(bundle.getString("MainFrame_File")); // NOI18N

    jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/project_open.png"))); // NOI18N
    jMenuItem2.setText(bundle.getString("MainFrame_Open...")); // NOI18N
    jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem2ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem2);

    jMenuItem9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/filesave.png"))); // NOI18N
    jMenuItem9.setText(bundle.getString("MainFrame_SaveAs...")); // NOI18N
    jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem9ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem9);
    jMenu3.add(jSeparator7);

    jMenuItem11.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/images/16x16/download_from_cloud.png"))); // NOI18N
    jMenuItem11.setText(bundle.getString("MainFrame_OpenFromCloud...")); // NOI18N
    jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem11ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem11);

    jMenuItem10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/upload_to_cloud.png"))); // NOI18N
    jMenuItem10.setText(bundle.getString("MainFrame_SaveToCloud...")); // NOI18N
    jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem10ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem10);
    jMenu3.add(jSeparator8);

    jMenuItem1.setText(bundle.getString("MainFrame_Exit")); // NOI18N
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem1ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem1);

    jMenuBar2.add(jMenu3);

    jMenu5.setText(bundle.getString("MainFrame_Edit")); // NOI18N

    jMenuItem4.setText(bundle.getString("MainFrame_AddStocks...")); // NOI18N
    jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem4ActionPerformed(evt);
        }
    });
    jMenu5.add(jMenuItem4);

    jMenuItem7.setText(bundle.getString("MainFrame_ClearAllStocks")); // NOI18N
    jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem7ActionPerformed(evt);
        }
    });
    jMenu5.add(jMenuItem7);
    jMenu5.add(jSeparator4);

    jMenuItem15.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R,
            java.awt.event.InputEvent.CTRL_MASK));
    jMenuItem15.setText(bundle.getString("MainFrame_RefreshStockPrices")); // NOI18N
    jMenuItem15.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem15ActionPerformed(evt);
        }
    });
    jMenu5.add(jMenuItem15);

    jMenuBar2.add(jMenu5);

    jMenu6.setText(bundle.getString("MainFrame_Country")); // NOI18N
    jMenu6.addMenuListener(new javax.swing.event.MenuListener() {
        public void menuCanceled(javax.swing.event.MenuEvent evt) {
        }

        public void menuDeselected(javax.swing.event.MenuEvent evt) {
        }

        public void menuSelected(javax.swing.event.MenuEvent evt) {
            jMenu6MenuSelected(evt);
        }
    });
    jMenuBar2.add(jMenu6);

    jMenu10.setText(bundle.getString("MainFrame_Language")); // NOI18N

    buttonGroup3.add(jRadioButtonMenuItem1);
    jRadioButtonMenuItem1.setSelected(true);
    jRadioButtonMenuItem1.setText(Locale.ENGLISH.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem1ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem1);

    buttonGroup3.add(jRadioButtonMenuItem2);
    jRadioButtonMenuItem2.setText(Locale.SIMPLIFIED_CHINESE.getDisplayName(Locale.getDefault()));
    jRadioButtonMenuItem2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem2ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem2);

    buttonGroup3.add(jRadioButtonMenuItem4);
    jRadioButtonMenuItem4.setText(Locale.TRADITIONAL_CHINESE.getDisplayName(Locale.getDefault()));
    jRadioButtonMenuItem4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem4ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem4);

    buttonGroup3.add(jRadioButtonMenuItem6);
    jRadioButtonMenuItem6.setText(Locale.FRENCH.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem6ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem6);

    buttonGroup3.add(jRadioButtonMenuItem3);
    jRadioButtonMenuItem3.setText(Locale.GERMAN.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem3ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem3);

    buttonGroup3.add(jRadioButtonMenuItem5);
    jRadioButtonMenuItem5.setText(Locale.ITALIAN.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem5ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem5);

    jMenuBar2.add(jMenu10);

    jMenu7.setText(bundle.getString("MainFrame_Database")); // NOI18N

    jMenuItem8.setText(bundle.getString("MainFrame_StockDatabase...")); // NOI18N
    jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem8ActionPerformed(evt);
        }
    });
    jMenu7.add(jMenuItem8);

    jMenuBar2.add(jMenu7);

    jMenu9.setText(bundle.getString("MainFrame_Watchlist")); // NOI18N
    jMenu9.addMenuListener(new javax.swing.event.MenuListener() {
        public void menuCanceled(javax.swing.event.MenuEvent evt) {
        }

        public void menuDeselected(javax.swing.event.MenuEvent evt) {
        }

        public void menuSelected(javax.swing.event.MenuEvent evt) {
            jMenu9MenuSelected(evt);
        }
    });
    jMenuBar2.add(jMenu9);

    jMenu8.setText(bundle.getString("MainFrame_Portfolio")); // NOI18N
    jMenu8.addMenuListener(new javax.swing.event.MenuListener() {
        public void menuCanceled(javax.swing.event.MenuEvent evt) {
        }

        public void menuDeselected(javax.swing.event.MenuEvent evt) {
        }

        public void menuSelected(javax.swing.event.MenuEvent evt) {
            jMenu8MenuSelected(evt);
        }
    });
    jMenuBar2.add(jMenu8);

    jMenu1.setText(bundle.getString("MainFrame_Options")); // NOI18N

    jMenuItem6.setText(bundle.getString("MainFrame_Options...")); // NOI18N
    jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem6ActionPerformed(evt);
        }
    });
    jMenu1.add(jMenuItem6);

    jMenuBar2.add(jMenu1);

    jMenu4.setText(bundle.getString("MainFrame_LooknFeel")); // NOI18N
    jMenuBar2.add(jMenu4);

    jMenu2.setText(bundle.getString("MainFrame_Help")); // NOI18N

    jMenuItem3.setText(bundle.getString("MainFrame_OnlineHelp")); // NOI18N
    jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem3ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem3);

    jMenuItem16.setText(bundle.getString("MainFrame_KeyboardShortcuts")); // NOI18N
    jMenuItem16.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem16ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem16);

    jMenuItem12.setText(bundle.getString("MainFrame_Calculator")); // NOI18N
    jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem12ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem12);
    jMenu2.add(jSeparator6);

    jMenuItem13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/smile2.png"))); // NOI18N
    jMenuItem13.setText(bundle.getString("MainFrame_DonateToJStock")); // NOI18N
    jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem13ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem13);

    jMenuItem14.setText(bundle.getString("MainFrame_ContributeToJStock")); // NOI18N
    jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem14ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem14);
    jMenu2.add(jSeparator5);

    jMenuItem5.setText(bundle.getString("MainFrame_About...")); // NOI18N
    jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem5ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem5);

    jMenuBar2.add(jMenu2);

    jMenu11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/android-small.png"))); // NOI18N
    jMenu11.setText(bundle.getString("MainFrame_Android")); // NOI18N
    jMenu11.setFont(jMenu11.getFont().deriveFont(jMenu11.getFont().getStyle() | java.awt.Font.BOLD));

    jMenuItem17.setText(bundle.getString("MainFrame_DownloadJStockAndroid")); // NOI18N
    jMenuItem17.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem17ActionPerformed(evt);
        }
    });
    jMenu11.add(jMenuItem17);

    jMenuBar2.add(jMenu11);

    setJMenuBar(jMenuBar2);

    setSize(new java.awt.Dimension(952, 478));
    setLocationRelativeTo(null);
}