List of usage examples for javax.swing SwingConstants RIGHT
int RIGHT
To view the source code for javax.swing SwingConstants RIGHT.
Click Source Link
From source file:org.yccheok.jstock.gui.MainFrame.java
/** This method is called from within the constructor to * initialize the form./* w w w . j ava 2 s.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() { buttonGroup1 = new javax.swing.ButtonGroup(); buttonGroup2 = new javax.swing.ButtonGroup(); buttonGroup3 = 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).attachResultObserver(getResultObserver()); ((AutoCompleteJComboBox) this.jComboBox1).attachMatchObserver(getMatchObserver()); 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 TableRowPopupListener()); this.jTable1.addKeyListener(new TableKeyEventListener()); 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 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); }
From source file:org.yccheok.jstock.gui.portfolio.DividendSummaryJDialog.java
/** This method is called from within the constructor to * initialize the form./*from w w w . j av a2 s . c om*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jXHeader1 = new org.jdesktop.swingx.JXHeader(); jPanel2 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jPanel4 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui"); // NOI18N setTitle(bundle.getString("DividendSummaryJDialog_DividendPayout")); // NOI18N setIconImage(null); setResizable(false); addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { formMouseClicked(evt); } }); getContentPane().setLayout(new java.awt.BorderLayout(5, 5)); jXHeader1.setDescription(bundle.getString("DividendSummaryJDialog_Description")); // NOI18N jXHeader1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/32x32/money2.png"))); // NOI18N jXHeader1.setTitle(bundle.getString("DividendSummaryJDialog_Dividend")); // NOI18N getContentPane().add(jXHeader1, java.awt.BorderLayout.NORTH); jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/apply.png"))); // NOI18N jButton1.setText(bundle.getString("DividendSummary_OK")); // NOI18N jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jPanel2.add(jButton1); jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/button_cancel.png"))); // NOI18N jButton2.setText(bundle.getString("DividendSummary_Cancel")); // NOI18N jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jPanel2.add(jButton2); getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH); jPanel1.setLayout(new java.awt.BorderLayout(5, 5)); jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/filenew.png"))); // NOI18N jButton3.setText(bundle.getString("DividendSummaryJDialog_New")); // NOI18N jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jPanel3.add(jButton3); jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/editdelete.png"))); // NOI18N jButton4.setText(bundle.getString("DividendSummaryJDialog_Delete")); // NOI18N jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jPanel3.add(jButton4); jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/auto-dividend.png"))); // NOI18N jButton5.setText(bundle.getString("DividendSummaryJDialog_AutoDividend...")); // NOI18N jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jPanel3.add(jButton5); jPanel1.add(jPanel3, java.awt.BorderLayout.NORTH); jLabel1.setForeground(new java.awt.Color(0, 0, 255)); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText(bundle.getString("DividendSummaryJDialog_TotalDividend")); // NOI18N jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jPanel4.add(jLabel1); jLabel2.setForeground(new java.awt.Color(0, 0, 255)); jLabel2.setText(getDividendSummaryText()); jLabel2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel2MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel2MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { jLabel2MouseExited(evt); } }); jPanel4.add(jLabel2); jPanel1.add(jPanel4, java.awt.BorderLayout.PAGE_END); jTable1.setModel(new DividendSummaryTableModel(this.dividendSummary)); org.yccheok.jstock.gui.table.CurrencyRenderer currencyRenderer = new org.yccheok.jstock.gui.table.CurrencyRenderer(); org.yccheok.jstock.gui.table.NonNegativeEmptyDoubleEditor currencyEditor = new org.yccheok.jstock.gui.table.NonNegativeEmptyDoubleEditor(); currencyRenderer.setHorizontalAlignment(org.yccheok.jstock.gui.table.CurrencyRenderer.RIGHT); ((JTextField) currencyEditor.getComponent()).setHorizontalAlignment(SwingConstants.RIGHT); jTable1.setDefaultEditor(Double.class, currencyEditor); jTable1.setDefaultRenderer(Double.class, currencyRenderer); jTable1.setDefaultEditor(StockInfo.class, new org.yccheok.jstock.gui.table.StockInfoEditor( this.portfolioManagementJPanel.getStockInfosFromPortfolios())); jTable1.setDefaultRenderer(StockInfo.class, new StockInfoRenderer()); // JTableCustomizer.setEditorForRow(jTable1, 1); // Do not use JTableCustomizer. We need to have our own implementation to decide // row background color. JTableUtilities.setDateEditorAndRendererForRow(jTable1, 0); jTable1.setAutoCreateRowSorter(true); jTable1.addMouseListener(new TableRowPopupListener()); if (JStock.instance().getJStockOptions().useLargeFont()) { this.jTable1.setRowHeight((int) (this.jTable1.getRowHeight() * Constants.FONT_ENLARGE_FACTOR)); } jTable1.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { jTable1PropertyChange(evt); } }); jTable1.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jTable1KeyPressed(evt); } }); jScrollPane1.setViewportView(jTable1); jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER); getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); setSize(new java.awt.Dimension(339, 373)); setLocationRelativeTo(null); }
From source file:pcgen.core.SettingsHandler.java
private static int getOptionTabPlacement(final String optionName, final int defaultValue) { final String aString = getPCGenOption(optionName, convertTabPlacementToString(defaultValue)); int iVal;//w w w. j a v a 2 s. c om try { iVal = Integer.parseInt(aString); switch (iVal) { case SwingConstants.TOP: case SwingConstants.LEFT: case SwingConstants.BOTTOM: case SwingConstants.RIGHT: break; default: iVal = defaultValue; break; } } catch (NumberFormatException exc) { if ("TOP".equals(aString)) //$NON-NLS-1$ { iVal = SwingConstants.TOP; } else if ("LEFT".equals(aString)) //$NON-NLS-1$ { iVal = SwingConstants.LEFT; } else if ("BOTTOM".equals(aString)) //$NON-NLS-1$ { iVal = SwingConstants.BOTTOM; } else if ("RIGHT".equals(aString)) //$NON-NLS-1$ { iVal = SwingConstants.RIGHT; } else { iVal = defaultValue; } } return iVal; }
From source file:pcgen.core.SettingsHandler.java
private static String convertTabPlacementToString(final int placement) { switch (placement) { case SwingConstants.BOTTOM: return "BOTTOM"; //$NON-NLS-1$ case SwingConstants.LEFT: return "LEFT"; //$NON-NLS-1$ case SwingConstants.RIGHT: return "RIGHT"; //$NON-NLS-1$ case SwingConstants.TOP: default:// ww w . ja v a 2s. c o m return "TOP"; //$NON-NLS-1$ } }
From source file:pcgen.gui2.tabs.SummaryInfoTab.java
private void initRightPanel(JPanel rightPanel) { rightPanel.setLayout(new GridBagLayout()); /*//from w ww .ja v a2 s .co m * initialize Components */ racePanel.setOpaque(false); classPanel.setOpaque(false); ageField.setHorizontalAlignment(SwingConstants.RIGHT); expField.setHorizontalAlignment(SwingConstants.RIGHT); nextlevelField.setHorizontalAlignment(SwingConstants.RIGHT); nextlevelField.setEnabled(false); expmodField.setHorizontalAlignment(SwingConstants.RIGHT); raceComboBox.setPrototypeDisplayValue("PrototypeDisplayValue"); //$NON-NLS-1$ classComboBox.setPrototypeDisplayValue("PrototypeDisplayValue"); //$NON-NLS-1$ expaddButton.setMargin(new Insets(0, 8, 0, 8)); expsubtractButton.setMargin(new Insets(0, 8, 0, 8)); hpButton.setMargin(new Insets(0, 0, 0, 0)); JPanel expmodPanel = new JPanel(new GridBagLayout()); JPanel levelPanel = new JPanel(); JLabel raceLabel = createLabel("in_sumRace"); //$NON-NLS-1$ JLabel ageLabel = createLabel("in_sumAge"); //$NON-NLS-1$ JLabel classLabel = createLabel("in_sumClass"); //$NON-NLS-1$ JLabel hpLabel = createLabel("in_sumTotalHP"); //$NON-NLS-1$ JLabel expLabel = createLabel("in_sumCurrentXp"); //$NON-NLS-1$ JLabel nextlevelLabel = createLabel("in_sumNextlevel"); //$NON-NLS-1$ JLabel xpTableLabel = createLabel("in_sumXpTable"); //$NON-NLS-1$ JLabel expmodLabel = createLabel("in_sumExpMod"); //$NON-NLS-1$ expmodLabel.setHorizontalAlignment(SwingConstants.CENTER); initLevelPanel(levelPanel); /* * initialize constant variables */ Insets racePanelInsets = racePanel.getInsets(); Insets classPanelInsets = classPanel.getInsets(); /* * racePanel */ GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.insets = new Insets(racePanelInsets.top, racePanelInsets.left, 0, 0); gbc.gridwidth = 2; rightPanel.add(raceLabel, gbc); gbc.insets = new Insets(racePanelInsets.top, 1, 1, racePanelInsets.right); gbc.gridwidth = GridBagConstraints.REMAINDER; rightPanel.add(raceComboBox, gbc); gbc.insets = new Insets(0, racePanelInsets.left, 0, 1); gbc.gridwidth = 1; rightPanel.add(ageLabel, gbc); gbc.insets = new Insets(1, 1, 1, 1); rightPanel.add(ageField, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.insets = new Insets(1, 1, 1, racePanelInsets.right); rightPanel.add(ageComboBox, gbc); gbc.insets = new Insets(1, racePanelInsets.left, racePanelInsets.bottom, racePanelInsets.right); rightPanel.add(createMonsterButton, gbc); /* * classPanel */ gbc.gridwidth = 2; gbc.insets = new Insets(classPanelInsets.top, classPanelInsets.left, 0, 0); rightPanel.add(classLabel, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.insets = new Insets(classPanelInsets.top, 0, 0, classPanelInsets.right); rightPanel.add(classComboBox, gbc); gbc.weighty = 1; gbc.fill = GridBagConstraints.BOTH; gbc.insets = new Insets(7, classPanelInsets.left, 0, classPanelInsets.right); rightPanel.add(levelPanel, gbc); gbc.insets.top = 0; gbc.insets.bottom = 10; gbc.weighty = 0; { JPanel hpPanel = new JPanel(new FlowLayout()); hpPanel.add(hpLabel); hpPanel.add(Box.createHorizontalStrut(3)); hpPanel.add(totalHPLabel); hpPanel.add(hpButton); rightPanel.add(hpPanel, gbc); } gbc.insets.bottom = 0; GridBagConstraints leftgbc = new GridBagConstraints(); leftgbc.insets = new Insets(0, classPanelInsets.left, 0, 0); leftgbc.gridwidth = 2; leftgbc.fill = GridBagConstraints.BOTH; GridBagConstraints rightgbc = new GridBagConstraints(); rightgbc.insets = new Insets(0, 0, 0, classPanelInsets.right); rightgbc.gridwidth = GridBagConstraints.REMAINDER; rightgbc.fill = GridBagConstraints.BOTH; rightPanel.add(expLabel, leftgbc); rightPanel.add(expField, rightgbc); rightPanel.add(nextlevelLabel, leftgbc); rightPanel.add(nextlevelField, rightgbc); rightPanel.add(xpTableLabel, leftgbc); rightPanel.add(xpTableComboBox, rightgbc); gbc.insets.top = 10; rightPanel.add(expmodLabel, gbc); { GridBagConstraints gbc2 = new GridBagConstraints(); gbc2.fill = GridBagConstraints.HORIZONTAL; gbc2.weightx = 1.0; gbc2.insets = new Insets(0, 1, 0, 1); expmodPanel.add(expaddButton, gbc2); expmodPanel.add(expsubtractButton, gbc2); } leftgbc.insets.bottom = classPanelInsets.bottom; leftgbc.weightx = 0.3; rightPanel.add(expmodPanel, leftgbc); rightgbc.insets.bottom = classPanelInsets.bottom; rightgbc.weightx = 0.7; rightPanel.add(expmodField, rightgbc); gbc = new GridBagConstraints(); gbc.gridx = gbc.gridy = 0; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.gridheight = 3; gbc.fill = GridBagConstraints.BOTH; rightPanel.add(racePanel, gbc); gbc.gridy = 3; gbc.gridheight = GridBagConstraints.REMAINDER; rightPanel.add(classPanel, gbc); }
From source file:pcgen.gui2.tabs.SummaryInfoTab.java
private void initLevelPanel(JPanel panel) { panel.setLayout(new GridBagLayout()); JLabel addLabel = createLabel("in_sumAddLevels"); //$NON-NLS-1$ JLabel removeLabel = createLabel("in_sumRemoveLevels"); //$NON-NLS-1$ JLabel darrowLabel = new JLabel(Icons.button_arrow_down.getImageIcon()); JLabel uarrowLabel = new JLabel(Icons.button_arrow_up.getImageIcon()); addLevelsButton.setMargin(new Insets(0, 8, 0, 8)); addLevelsField.setValue(1);/*from w w w. j ava 2s . c om*/ addLevelsField.setHorizontalAlignment(SwingConstants.RIGHT); removeLevelsButton.setMargin(new Insets(0, 8, 0, 8)); removeLevelsField.setValue(1); removeLevelsField.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gbc1 = new GridBagConstraints(); GridBagConstraints gbc2 = new GridBagConstraints(); gbc1.weightx = gbc2.weightx = 0.5; gbc1.insets = new Insets(1, 0, 1, 0); gbc2.insets = new Insets(1, 0, 1, 0); gbc2.gridwidth = GridBagConstraints.REMAINDER; panel.add(addLabel, gbc1); panel.add(removeLabel, gbc2); gbc1.ipadx = 30; panel.add(addLevelsField, gbc1); gbc2.ipadx = 30; panel.add(removeLevelsField, gbc2); gbc1.ipadx = 0; panel.add(addLevelsButton, gbc1); gbc2.ipadx = 0; panel.add(removeLevelsButton, gbc2); panel.add(darrowLabel, gbc1); panel.add(uarrowLabel, gbc2); ClassLevelTableModel.initializeTable(classLevelTable); gbc2.weightx = 0; gbc2.weighty = 1; gbc2.fill = GridBagConstraints.BOTH; panel.add(new JScrollPane(classLevelTable), gbc2); }
From source file:Proiect.uploadFTP.java
public void propFTP() { uploadFTP.setBackground(Encrypter.color_light); pan1.setBackground(Encrypter.color_light); pan1.setBorder(BorderFactory.createEmptyBorder(6, 5, 10, 5)); pan2.setBackground(Encrypter.color_light); inpan1.setBackground(Encrypter.color_light); inpan2.setBackground(Encrypter.color_light); pan3.setBackground(Encrypter.color_light); pan4.setBackground(Encrypter.color_light); adress.setForeground(Encrypter.color_blue); user.setForeground(Encrypter.color_blue); pass.setForeground(Encrypter.color_blue); folder.setForeground(Encrypter.color_blue); filen.setForeground(Encrypter.color_blue); adressf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark)); adressf.setSelectionColor(Encrypter.color_black); adressf.setSelectedTextColor(Encrypter.color_white); adressf.setBackground(Encrypter.color_light); userf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark)); userf.setSelectionColor(Encrypter.color_black); userf.setSelectedTextColor(Encrypter.color_white); userf.setBackground(Encrypter.color_light); passf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark)); passf.setSelectionColor(Encrypter.color_black); passf.setSelectedTextColor(Encrypter.color_white); passf.setBackground(Encrypter.color_light); folderf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark)); folderf.setSelectionColor(Encrypter.color_black); folderf.setSelectedTextColor(Encrypter.color_white); folderf.setBackground(Encrypter.color_light); status.setHorizontalAlignment(SwingConstants.RIGHT); ImageIcon title_icon = getImageIcon("assets/icons/upload.png"); titleFTP.setForeground(Encrypter.color_blue); titleFTP.setFont(Encrypter.font16);//from ww w. j a va2s . co m titleFTP.setIcon(title_icon); connect.setBackground(Encrypter.color_light); connect.setBorder(BorderFactory.createEmptyBorder()); connect.setForeground(Encrypter.color_black); connect.setFont(Encrypter.font16); connect.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); connect.setToolTipText("Transfer File"); browsef.setBackground(Encrypter.color_light); browsef.setBorder(BorderFactory.createEmptyBorder()); browsef.setForeground(Encrypter.color_black); browsef.setFont(Encrypter.font16); browsef.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); browsef.setToolTipText("Add file"); ImageIcon exit_icon = getImageIcon("assets/icons/exit.png"); exit.setBackground(Encrypter.color_light); exit.setBorder(BorderFactory.createLineBorder(Encrypter.color_dark, 0)); exit.setForeground(Encrypter.color_black); exit.setFont(Encrypter.font16); exit.setIcon(exit_icon); exit.setToolTipText("Exit"); ImageIcon adv_icon = getImageIcon("assets/icons/adv_ftp.png"); adv.setIcon(adv_icon); adv.setBackground(Encrypter.color_light); adv.setBorder(BorderFactory.createLineBorder(Encrypter.color_light, 0)); adv.setFont(Encrypter.font16); adv.setToolTipText("Display server files"); adv.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); chooserf.addChoosableFileFilter(new FileNameExtensionFilter("Text", "txt")); chooserf.addChoosableFileFilter(new FileNameExtensionFilter("HTM", "htm")); chooserf.addChoosableFileFilter(new FileNameExtensionFilter("XHTML", "xhtml")); chooserf.addChoosableFileFilter(new FileNameExtensionFilter("HTML", "html")); chooserf.setAcceptAllFileFilterUsed(false); }
From source file:Provider.GoogleMapsStatic.TestUI.MySample.java
/** * @author Nazmul//from w w w . ja v a2 s.c o m */ private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license ttfSizeW = new JTextField("512"); ttfLat = new JTextField("45.5"); btnGetMap = new JButton("Get Map"); btnQuit = new JButton("Quit"); ttfSizeH = new JTextField("512"); ttfLon = new JTextField("-73.55"); ttfZoom = new JTextField("14"); ttaStatus = new JTextArea(); checkboxRecvStatus = new JCheckBox(); checkboxSendStatus = new JCheckBox(); ttfProgressMsg = new JTextField(); progressBar = new JProgressBar(); imgLbl = new JLabel(); /*** * @author Dhgiang, jpmolinamatute * Created a slider, zoom in/out buttons, conbo box (drop down listbox) for city selection, * a panel to group the zoom buttons and the slider bar */ slider = new JSlider(0, 19, 14); controlPanel = new JPanel(new GridBagLayout()); // controlPanel was created by jpmolinamatute cities = new JComboBox<Object>(new String[] { "Montreal", "Toronto", // the place setting where the combo box is now used to be a text field "Vancouver", "New York City", "Caracas", "Hong Kong" }); // for license key, but it was removed to accommodate space for combo box // @author Dhgiang JPanel panel1 = new JPanel(); JPanel contentPanel = new JPanel(); JPanel btnPanel = new JPanel(); JPanel dialogPane = new JPanel(); JLabel label1 = new JLabel("Select City"); // this used to be the label for license key, it was changed to label as 'select city' JLabel label2 = new JLabel("Size Width"); JLabel label3 = new JLabel("Size Height"); JLabel label4 = new JLabel("Latitude"); JLabel label5 = new JLabel("Longitude"); JLabel label6 = new JLabel("Zoom"); JButton btnZoomIn = new JButton("-"); JButton btnZoomOut = new JButton("+"); /*** * @author jpmolinamatute * Created 8 cardinal points: N,NE,NW; S,SE,SW; E, W; */ JButton btnSE = new JButton("SE"); JButton btnS = new JButton("S"); JButton btnSW = new JButton("SW"); JButton btnE = new JButton("E"); JButton btnW = new JButton("W"); JButton btnNE = new JButton("NE"); JButton btnN = new JButton("N"); JButton btnNW = new JButton("NW"); /*** * @author JPMolinaMatute * Creaetd a spaceControl GridBagConstraints object to manage * the cardinal points, and add KeyListener so users can use the * 8 cardinal keys on the num pad; initialize dimensions * */ GridBagConstraints spaceControl = new GridBagConstraints(); spaceControl.insets = new Insets(5, 5, 5, 5); controlPanel.addKeyListener(this); controlPanel.setSize(new Dimension(512, 512)); // ---- My Combo Boxes for different city coordinates ----// // ======== this ======== setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("Google Static Maps"); setIconImage(null); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== dialogPane ======== { dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setOpaque(false); dialogPane.setLayout(new BorderLayout()); // ======== contentPanel ======== { contentPanel.setOpaque(false); contentPanel.setLayout(new TableLayout( new double[][] { { TableLayoutConstants.FILL }, { TableLayoutConstants.PREFERRED, TableLayoutConstants.FILL, TableLayoutConstants.PREFERRED } })); ((TableLayout) contentPanel.getLayout()).setHGap(5); ((TableLayout) contentPanel.getLayout()).setVGap(5); // ======== panel1 ======== { panel1.setOpaque(false); panel1.setBorder(new CompoundBorder( new TitledBorder("Configure the inputs to Google Static Maps"), Borders.DLU2_BORDER)); panel1.setLayout(new TableLayout( new double[][] { { 0.17, 0.17, 0.17, 0.17, 0.05, TableLayoutConstants.FILL }, { TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED } })); ((TableLayout) panel1.getLayout()).setHGap(5); ((TableLayout) panel1.getLayout()).setVGap(5); label1.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label1, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label2 ---- label2.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label2, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfSizeW ---- panel1.add(ttfSizeW, new TableLayoutConstraints(1, 0, 1, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label4 ---- label4.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label4, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfLat ---- panel1.add(ttfLat, new TableLayoutConstraints(3, 0, 3, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- btnGetMap ---- btnGetMap.setHorizontalAlignment(SwingConstants.LEFT); btnGetMap.setMnemonic('G'); btnGetMap.setActionCommand("getMap"); btnGetMap.addActionListener(this); panel1.add(btnGetMap, new TableLayoutConstraints(5, 0, 5, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label3 ---- label3.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label3, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfSizeH ---- panel1.add(ttfSizeH, new TableLayoutConstraints(1, 1, 1, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label5 ---- label5.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label5, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfLon ---- panel1.add(ttfLon, new TableLayoutConstraints(3, 1, 3, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- btnQuit ---- btnQuit.setMnemonic('Q'); btnQuit.setHorizontalAlignment(SwingConstants.LEFT); btnQuit.setHorizontalTextPosition(SwingConstants.RIGHT); btnQuit.setActionCommand("quit"); btnQuit.addActionListener(this); panel1.add(btnQuit, new TableLayoutConstraints(5, 1, 5, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); /*** * @author Dhgiang * Added an anonymous inner class for ItemLister and event handling for the combo box * Used the switch case condition handling to set coordinates based on the city selected * Juan helped modified this method by adding the startTaskAction() at the end so * users don't have to click on Get Map button. */ cities.setSelectedIndex(0); // initialize the city selection item to 0 (or the first item) cities.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { Integer z = cities.getSelectedIndex(); switch (z) { case 0: ttfLat.setText("45.5"); ttfLon.setText("-73.55"); break; case 1: ttfLat.setText("43.65"); ttfLon.setText("-79.38"); break; case 2: ttfLat.setText("49.2505"); ttfLon.setText("-123.1119"); break; case 3: ttfLat.setText("40.7142"); ttfLon.setText("-74.0064"); break; case 4: ttfLat.setText("10.4901"); ttfLon.setText("-66.9151"); break; case 5: ttfLat.setText("22.257"); ttfLon.setText("114.2"); break; default: break; } startTaskAction(); } }); /*** * @author Dhgiang * Added the combo box to the panel */ panel1.add(cities, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); // ---- label6 ---- label6.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label6, new TableLayoutConstraints(2, 2, 2, 2, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfZoom ---- panel1.add(ttfZoom, new TableLayoutConstraints(3, 2, 3, 2, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); } { btnPanel.setOpaque(false); btnPanel.setLayout(new GridLayout(0, 3)); /**** * @author Dhgiang * Initializing the zoom IN / OUT buttons with proper parameters and * adding them to the btnPanel of Panel1 (panel within a panel) */ // ---- btnZoomIn ---- btnZoomIn.setHorizontalAlignment(SwingConstants.LEFT); btnZoomIn.setHorizontalTextPosition(SwingConstants.RIGHT); btnZoomIn.setActionCommand("Zoomin"); btnZoomIn.addActionListener(this); btnPanel.add(btnZoomIn, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); // ---- btnZoomOut ---- btnZoomOut.setHorizontalAlignment(SwingConstants.RIGHT); btnZoomOut.setHorizontalTextPosition(SwingConstants.RIGHT); btnZoomOut.setActionCommand("Zoomout"); btnZoomOut.addActionListener(this); btnPanel.add(btnZoomOut, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); /*** * @author Dhgiang * Having created a new JSlider slider object, maximum & minimum values * are initialized along with incremental values * */ // ---- slider ----- slider.setMaximum(19); slider.setMinimum(0); slider.setPaintTicks(true); slider.setMajorTickSpacing(19); slider.setMinorTickSpacing(1); slider.setPaintTrack(false); slider.createStandardLabels(4, 0); /*** * @author Dhgiang * Added a ChangeListener to the slider so that * 1) the slider moves left if (-) button is clicked, slider moves right if (+) is clicked * 2) and zoom values will increase or decrease if slider bar is shifted left or right accordingly * 3) after the user releases the click button, the map will display automatically with the values * set by the slider bar, without having the user to click on get map button */ slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { Integer a = slider.getValue(); if (a >= 0 && a <= 19) { ttfZoom.setText(a.toString()); startTaskAction(); } } }); slider.setBorder(null); /*** * @author Dhgiang * Added the slider bar to the button panel */ btnPanel.add(slider, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } /*** * @author Dhgiang * Adding the button panel to panel1 */ panel1.add(btnPanel, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); contentPanel.add(panel1, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); /*** * @author jpmolinamatute * Initializing coordinates for the cardinal points * Adding the cardinal points button to the control panel */ // ---- Cardinals points ----- btnNW.setActionCommand("Northwest"); btnNW.addActionListener(this); spaceControl.gridx = 0; spaceControl.gridy = 0; controlPanel.add(btnNW, spaceControl); btnN.setActionCommand("North"); btnN.addActionListener(this); spaceControl.gridx = 3; spaceControl.gridy = 0; controlPanel.add(btnN, spaceControl); btnNE.setActionCommand("Northeast"); btnNE.addActionListener(this); spaceControl.gridx = 6; spaceControl.gridy = 0; controlPanel.add(btnNE, spaceControl); btnW.setActionCommand("West"); btnW.addActionListener(this); spaceControl.gridx = 0; spaceControl.gridy = 3; controlPanel.add(btnW, spaceControl); spaceControl.gridx = 3; spaceControl.gridy = 3; controlPanel.add(imgLbl, spaceControl); btnE.setActionCommand("East"); btnE.addActionListener(this); spaceControl.gridx = 6; spaceControl.gridy = 3; controlPanel.add(btnE, spaceControl); btnSW.setActionCommand("Southwest"); btnSW.addActionListener(this); spaceControl.gridx = 0; spaceControl.gridy = 6; controlPanel.add(btnSW, spaceControl); btnS.setActionCommand("South"); btnS.addActionListener(this); spaceControl.gridx = 3; spaceControl.gridy = 6; controlPanel.add(btnS, spaceControl); btnSE.setActionCommand("Southeast"); btnSE.addActionListener(this); spaceControl.gridx = 6; spaceControl.gridy = 6; controlPanel.add(btnSE, spaceControl); contentPanel.add(controlPanel, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); } dialogPane.add(contentPanel, BorderLayout.CENTER); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(700, 800); setLocationRelativeTo(null); }
From source file:Provider.GoogleMapsStatic.TestUI.SampleApp.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license dialogPane = new JPanel(); contentPanel = new JPanel(); panel1 = new JPanel(); label2 = new JLabel(); ttfSizeW = new JTextField(); label4 = new JLabel(); ttfLat = new JTextField(); btnGetMap = new JButton(); label3 = new JLabel(); ttfSizeH = new JTextField(); label5 = new JLabel(); ttfLon = new JTextField(); btnQuit = new JButton(); label1 = new JLabel(); ttfLicense = new JTextField(); label6 = new JLabel(); ttfZoom = new JTextField(); scrollPane1 = new JScrollPane(); ttaStatus = new JTextArea(); panel2 = new JPanel(); panel3 = new JPanel(); checkboxRecvStatus = new JCheckBox(); checkboxSendStatus = new JCheckBox(); ttfProgressMsg = new JTextField(); progressBar = new JProgressBar(); lblProgressStatus = new JLabel(); //======== this ======== setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("Google Static Maps"); setIconImage(null);/*from w ww. ja v a2 s .c o m*/ Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== { dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setOpaque(false); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setOpaque(false); contentPanel.setLayout(new TableLayout(new double[][] { { TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED } })); ((TableLayout) contentPanel.getLayout()).setHGap(5); ((TableLayout) contentPanel.getLayout()).setVGap(5); //======== panel1 ======== { panel1.setOpaque(false); panel1.setBorder(new CompoundBorder( new TitledBorder("Configure the inputs to Google Static Maps"), Borders.DLU2_BORDER)); panel1.setLayout( new TableLayout(new double[][] { { 0.17, 0.17, 0.17, 0.17, 0.05, TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } })); ((TableLayout) panel1.getLayout()).setHGap(5); ((TableLayout) panel1.getLayout()).setVGap(5); //---- label2 ---- label2.setText("Size Width"); label2.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label2, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfSizeW ---- ttfSizeW.setText("512"); panel1.add(ttfSizeW, new TableLayoutConstraints(1, 0, 1, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label4 ---- label4.setText("Latitude"); label4.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label4, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLat ---- ttfLat.setText("38.931099"); panel1.add(ttfLat, new TableLayoutConstraints(3, 0, 3, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- btnGetMap ---- btnGetMap.setText("Get Map"); btnGetMap.setHorizontalAlignment(SwingConstants.LEFT); btnGetMap.setMnemonic('G'); btnGetMap.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startTaskAction(); } }); panel1.add(btnGetMap, new TableLayoutConstraints(5, 0, 5, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label3 ---- label3.setText("Size Height"); label3.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label3, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfSizeH ---- ttfSizeH.setText("512"); panel1.add(ttfSizeH, new TableLayoutConstraints(1, 1, 1, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label5 ---- label5.setText("Longitude"); label5.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label5, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLon ---- ttfLon.setText("-77.3489"); panel1.add(ttfLon, new TableLayoutConstraints(3, 1, 3, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- btnQuit ---- btnQuit.setText("Quit"); btnQuit.setMnemonic('Q'); btnQuit.setHorizontalAlignment(SwingConstants.LEFT); btnQuit.setHorizontalTextPosition(SwingConstants.RIGHT); btnQuit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { quitProgram(); } }); panel1.add(btnQuit, new TableLayoutConstraints(5, 1, 5, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label1 ---- label1.setText("License Key"); label1.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label1, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLicense ---- ttfLicense.setToolTipText("Enter your own URI for a file to download in the background"); panel1.add(ttfLicense, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label6 ---- label6.setText("Zoom"); label6.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label6, new TableLayoutConstraints(2, 2, 2, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfZoom ---- ttfZoom.setText("14"); panel1.add(ttfZoom, new TableLayoutConstraints(3, 2, 3, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } contentPanel.add(panel1, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //======== scrollPane1 ======== { scrollPane1.setBorder( new TitledBorder("System.out - displays all status and progress messages, etc.")); scrollPane1.setOpaque(false); //---- ttaStatus ---- ttaStatus.setBorder(Borders.createEmptyBorder("1dlu, 1dlu, 1dlu, 1dlu")); ttaStatus.setToolTipText( "<html>Task progress updates (messages) are displayed here,<br>along with any other output generated by the Task.<html>"); scrollPane1.setViewportView(ttaStatus); } contentPanel.add(scrollPane1, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //======== panel2 ======== { panel2.setOpaque(false); panel2.setBorder(new CompoundBorder(new TitledBorder("Status - control progress reporting"), Borders.DLU2_BORDER)); panel2.setLayout(new TableLayout(new double[][] { { 0.45, TableLayout.FILL, 0.45 }, { TableLayout.PREFERRED, TableLayout.PREFERRED } })); ((TableLayout) panel2.getLayout()).setHGap(5); ((TableLayout) panel2.getLayout()).setVGap(5); //======== panel3 ======== { panel3.setOpaque(false); panel3.setLayout(new GridLayout(1, 2)); //---- checkboxRecvStatus ---- checkboxRecvStatus.setText("Enable \"Recieve\""); checkboxRecvStatus.setOpaque(false); checkboxRecvStatus.setToolTipText("Task will fire \"send\" status updates"); checkboxRecvStatus.setSelected(true); panel3.add(checkboxRecvStatus); //---- checkboxSendStatus ---- checkboxSendStatus.setText("Enable \"Send\""); checkboxSendStatus.setOpaque(false); checkboxSendStatus.setToolTipText("Task will fire \"recieve\" status updates"); panel3.add(checkboxSendStatus); } panel2.add(panel3, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfProgressMsg ---- ttfProgressMsg.setText("Loading map from Google Static Maps"); ttfProgressMsg.setToolTipText("Set the task progress message here"); panel2.add(ttfProgressMsg, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- progressBar ---- progressBar.setStringPainted(true); progressBar.setString("progress %"); progressBar.setToolTipText("% progress is displayed here"); panel2.add(progressBar, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- lblProgressStatus ---- lblProgressStatus.setText("task status listener"); lblProgressStatus.setHorizontalTextPosition(SwingConstants.LEFT); lblProgressStatus.setHorizontalAlignment(SwingConstants.LEFT); lblProgressStatus.setToolTipText("Task status messages are displayed here when the task runs"); panel2.add(lblProgressStatus, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } contentPanel.add(panel2, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } dialogPane.add(contentPanel, BorderLayout.CENTER); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(675, 485); setLocationRelativeTo(null); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:ro.nextreports.engine.exporter.ResultExporter.java
private void buildCellHAllign(Map<String, Object> format, int hAllign) { if (SwingConstants.CENTER == hAllign) { format.put(StyleFormatConstants.HORIZONTAL_ALIGN_KEY, StyleFormatConstants.HORIZONTAL_ALIGN_CENTER); }// w w w .ja v a 2 s .c om if (SwingConstants.LEFT == hAllign) { format.put(StyleFormatConstants.HORIZONTAL_ALIGN_KEY, StyleFormatConstants.HORIZONTAL_ALIGN_LEFT); } if (SwingConstants.RIGHT == hAllign) { format.put(StyleFormatConstants.HORIZONTAL_ALIGN_KEY, StyleFormatConstants.HORIZONTAL_ALIGN_RIGHT); } }