List of usage examples for java.awt FlowLayout setAlignment
public void setAlignment(int align)
From source file:com.qawaa.gui.PointAnalysisGUI.java
/** * Auto-generated main method to display this JFrame *///from www . j a v a2s .c om public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { PointAnalysisGUI inst = new PointAnalysisGUI(); inst.setLocationRelativeTo(null); inst.setVisible(true); inst.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFrame.setDefaultLookAndFeelDecorated(true); FlowLayout flowLayout = new FlowLayout(); flowLayout.setAlignment(FlowLayout.LEFT); flowLayout.setAlignOnBaseline(true); inst.setTitle(PROGRAM_NAME + " [" + PROGRAM_VERSION + "] " + " - " + DefaultMessage.SOFT_NAME + " - " + DefaultMessage.COMPANY_NAME); { consoleScrollPane = new JScrollPane(); inst.getContentPane().add(consoleScrollPane, BorderLayout.CENTER); { consolePane = new JEditorPane(); consoleScrollPane.setViewportView(consolePane); consolePane.setText(""); setConsoleRight(); jConsole = new JConsole(System.out, consolePane); System.setOut(jConsole); System.setErr(jConsole); consolePane.setEditable(false); consolePane.addMouseListener(new MouseAdapter() { /* (non-Javadoc) * @see java.awt.event.MouseAdapter#mouseReleased(java.awt.event.MouseEvent) */ public void mouseReleased(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { consolePane.add(consoleRight); consoleRight.show(e.getComponent(), e.getX(), e.getY()); } } }); } } { infoPanel = new JPanel(); inst.getContentPane().add(infoPanel, BorderLayout.SOUTH); infoPanel.setBorder(new LineBorder(new Color(0, 0, 0), 1, false)); infoPanel.setPreferredSize(new Dimension(784, 30)); infoPanel.setLayout(flowLayout); { { statusbar_count = new JTextPane(); infoPanel.add(statusbar_count); statusbar_count .setText(CONTEXT.getMessage("point.statusbar.count", null, Locale.CHINA)); statusbar_count.setBackground(null); statusbar_count.setEditable(false); } { statusbar_count_value = new JTextPane(); infoPanel.add(statusbar_count_value); statusbar_count_value.setText(String.valueOf(SCAN_COUNT)); statusbar_count_value.setBackground(null); statusbar_count_value.setEditable(false); statusbar_count_value.setEnabled(false); } { programPID = new JTextPane(); infoPanel.add(programPID); programPID.setText("PID:"); programPID.setBackground(null); programPID.setEditable(false); } { programPID_value = new JTextPane(); infoPanel.add(programPID_value); programPID_value.setText(JvmPid.getPID()); programPID_value.setBackground(null); programPID_value.setEditable(false); programPID_value.setEnabled(false); } { memory = new JTextPane(); infoPanel.add(memory); memory.setText(CONTEXT.getMessage("gobal.gui.memory", null, Locale.CHINA)); memory.setBackground(null); memory.setEditable(false); } { memory_value = new JTextPane(); infoPanel.add(memory_value); memory_value.setText("0KB"); memory_value.setBackground(null); memory_value.setEditable(false); memory_value.setEnabled(false); MemoryListener memory = new MemoryListener(memory_value); memory.start(); } { runtime = new JTextPane(); infoPanel.add(runtime); runtime.setText(CONTEXT.getMessage("gobal.gui.runtime", null, Locale.CHINA)); runtime.setBackground(null); runtime.setEditable(false); } { runtime_value = new JTextPane(); infoPanel.add(runtime_value); runtime_value.setText("NULL"); runtime_value.setBackground(null); runtime_value.setEditable(false); runtime_value.setEnabled(false); } } } { shortcut = new JPanel(); inst.getContentPane().add(shortcut, BorderLayout.NORTH); shortcut.setSize(784, 35); shortcut.setPreferredSize(new Dimension(784, 35)); shortcut.setBorder(new LineBorder(new Color(0, 0, 0), 1, false)); shortcut.setLayout(new BorderLayout()); { eventText = new JTextPane(); shortcut.add(eventText, BorderLayout.WEST); eventText.setText(CONTEXT.getMessage("point.event.name", null, Locale.CHINA) + ": "); eventText.setEditable(false); eventText.setEnabled(true); eventText.setBackground(null); eventText.setCaretColor(new Color(0, 0, 0)); } { eventTextField = new JTextField(); shortcut.add(eventTextField, BorderLayout.CENTER); eventTextField.setSize(500, 25); eventTextField.setText(""); eventTextField.setPreferredSize(new Dimension(500, 25)); eventTextField.setEditable(false); } { submit = new JButton(); shortcut.add(submit, BorderLayout.EAST); submit.setText(CONTEXT.getMessage("gobal.gui.button.run", null, Locale.CHINA)); submit.setSize(new Dimension(75, 25)); submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { submitActionPerformed(evt); } catch (InterruptedException e) { e.printStackTrace(); } } }); } } } }); }
From source file:com.qawaa.gui.EventWebScanGUI.java
/** * Auto-generated main method to display this JFrame */// w w w . j a va 2 s.c om public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { EventWebScanGUI inst = new EventWebScanGUI(); inst.setLocationRelativeTo(null); inst.setVisible(true); inst.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFrame.setDefaultLookAndFeelDecorated(true); FlowLayout flowLayout = new FlowLayout(); flowLayout.setAlignment(FlowLayout.LEFT); flowLayout.setAlignOnBaseline(true); inst.setTitle(PROGRAM_NAME + " [" + PROGRAM_VERSION + "] " + " - " + DefaultMessage.SOFT_NAME + " - " + DefaultMessage.COMPANY_NAME); { consoleScrollPane = new JScrollPane(); inst.getContentPane().add(consoleScrollPane, BorderLayout.CENTER); { consolePane = new JEditorPane(); consoleScrollPane.setViewportView(consolePane); consolePane.setText(""); setConsoleRight(); jConsole = new JConsole(System.out, consolePane); System.setOut(jConsole); System.setErr(jConsole); consolePane.setEditable(false); consolePane.addMouseListener(new MouseAdapter() { /* (non-Javadoc) * @see java.awt.event.MouseAdapter#mouseReleased(java.awt.event.MouseEvent) */ public void mouseReleased(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { consolePane.add(consoleRight); consoleRight.show(e.getComponent(), e.getX(), e.getY()); } } }); } } { infoPanel = new JPanel(); inst.getContentPane().add(infoPanel, BorderLayout.SOUTH); infoPanel.setBorder(new LineBorder(new Color(0, 0, 0), 1, false)); infoPanel.setPreferredSize(new Dimension(784, 30)); infoPanel.setLayout(flowLayout); { { statusbar_count = new JTextPane(); infoPanel.add(statusbar_count); statusbar_count.setText( CONTEXT.getMessage("event.web.scan.statusbar.count", null, Locale.CHINA)); statusbar_count.setBackground(null); statusbar_count.setEditable(false); } { statusbar_count_value = new JTextPane(); infoPanel.add(statusbar_count_value); statusbar_count_value.setText(String.valueOf(SCAN_COUNT)); statusbar_count_value.setBackground(null); statusbar_count_value.setEditable(false); statusbar_count_value.setEnabled(false); } { programPID = new JTextPane(); infoPanel.add(programPID); programPID.setText("PID:"); programPID.setBackground(null); programPID.setEditable(false); } { programPID_value = new JTextPane(); infoPanel.add(programPID_value); programPID_value.setText(JvmPid.getPID()); programPID_value.setBackground(null); programPID_value.setEditable(false); programPID_value.setEnabled(false); } { memory = new JTextPane(); infoPanel.add(memory); memory.setText(CONTEXT.getMessage("gobal.gui.memory", null, Locale.CHINA)); memory.setBackground(null); memory.setEditable(false); } { memory_value = new JTextPane(); infoPanel.add(memory_value); memory_value.setText("0KB"); memory_value.setBackground(null); memory_value.setEditable(false); memory_value.setEnabled(false); MemoryListener memory = new MemoryListener(memory_value); memory.start(); } { runtime = new JTextPane(); infoPanel.add(runtime); runtime.setText(CONTEXT.getMessage("gobal.gui.runtime", null, Locale.CHINA)); runtime.setBackground(null); runtime.setEditable(false); } { runtime_value = new JTextPane(); infoPanel.add(runtime_value); runtime_value.setText("NULL"); runtime_value.setBackground(null); runtime_value.setEditable(false); runtime_value.setEnabled(false); } } } { shortcut = new JPanel(); inst.getContentPane().add(shortcut, BorderLayout.NORTH); shortcut.setSize(784, 35); shortcut.setPreferredSize(new Dimension(784, 35)); shortcut.setBorder(new LineBorder(new Color(0, 0, 0), 1, false)); shortcut.setLayout(new BorderLayout()); { eventText = new JTextPane(); shortcut.add(eventText, BorderLayout.WEST); eventText.setText(CONTEXT.getMessage("event.web.scan.name", null, Locale.CHINA) + ": "); eventText.setEditable(false); eventText.setEnabled(true); eventText.setBackground(null); eventText.setCaretColor(new Color(0, 0, 0)); } { eventTextField = new JTextField(); shortcut.add(eventTextField, BorderLayout.CENTER); eventTextField.setSize(500, 25); eventTextField.setText(""); eventTextField.setPreferredSize(new Dimension(500, 25)); eventTextField.setEditable(false); } { submit = new JButton(); shortcut.add(submit, BorderLayout.EAST); submit.setText(CONTEXT.getMessage("gobal.gui.button.run", null, Locale.CHINA)); submit.setSize(new Dimension(75, 25)); submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { submitActionPerformed(evt); } catch (InterruptedException e) { e.printStackTrace(); } } }); } } } }); }
From source file:Main.java
public static JPanel getPanelFlowLayoutHorizontal(int w, int h, int type) { JPanel panel = new JPanel(); FlowLayout layout = new FlowLayout(); layout.setAlignment(type); panel.setLayout(layout);// w w w. j av a 2s . c om panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); panel.setPreferredSize(getControlDimension(w, h)); panel.setMinimumSize(getControlDimension(w, h)); return panel; }
From source file:Main.java
public Main() { FlowLayout flowLayout = new FlowLayout(FlowLayout.RIGHT, 10, 3); setLayout(flowLayout);//from www.j a v a2s . c o m add(new JButton("w w w.j a v a 2 s . c o m")); add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); flowLayout.setAlignment(FlowLayout.CENTER); }
From source file:gtu._work.ui.StringArrayMakerUI.java
private void initGUI() { try {/*from www. ja v a2 s.co m*/ BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("jPanel1", null, jPanel1, null); { jScrollPane2 = new JScrollPane(); jPanel1.add(jScrollPane2, BorderLayout.CENTER); jScrollPane2.setPreferredSize(new java.awt.Dimension(525, 267)); { ListModel jList1Model = new DefaultListModel(); jList1 = new JList(); jScrollPane2.setViewportView(jList1); jList1.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(jList1).defaultJListKeyPressed(evt); } }); jList1.setModel(jList1Model); } } { jButton1 = new JButton(); jPanel1.add(jButton1, BorderLayout.NORTH); jButton1.setText("\u8cbc\u4e0a"); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton1ActionPerformed(evt); } }); } { jPanel3 = new JPanel(); FlowLayout jPanel3Layout = new FlowLayout(); jPanel3Layout.setAlignment(FlowLayout.RIGHT); jPanel1.add(jPanel3, BorderLayout.WEST); jPanel3.setLayout(jPanel3Layout); jPanel3.setPreferredSize(new java.awt.Dimension(50, 291)); { jCheckBox1 = new JCheckBox(); jPanel3.add(jCheckBox1); jCheckBox1.setText("\\n"); } { jCheckBox2 = new JCheckBox(); jPanel3.add(jCheckBox2); jCheckBox2.setText("\\t"); } } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("jPanel2", null, jPanel2, null); { jButton2 = new JButton(); jPanel2.add(jButton2, BorderLayout.NORTH); jButton2.setText("\u7522\u751f"); jButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton2ActionPerformed(evt); } }); } { jScrollPane1 = new JScrollPane(); jPanel2.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(525, 291)); { jTextArea1 = new JTextArea(); jScrollPane1.setViewportView(jTextArea1); jTextArea1.setText(""); } } } } pack(); this.setSize(546, 382); } catch (Exception e) { // add your error handling code here e.printStackTrace(); } }
From source file:com.k42b3.aletheia.response.html.Images.java
public Images() { super();/*from w w w. j av a2 s. c o m*/ executorService = Executors.newFixedThreadPool(6); // settings this.setTitle("Images"); this.setLocation(100, 100); this.setPreferredSize(new Dimension(360, 600)); this.setMinimumSize(this.getSize()); this.setResizable(false); this.setLayout(new BorderLayout()); // list model = new DefaultListModel<URL>(); list = new JList<URL>(model); list.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { btnDownload.setEnabled(list.getSelectedIndex() != -1); } }); list.setCellRenderer(new ImageCellRenderer()); scp = new JScrollPane(list); scp.setBorder(new EmptyBorder(4, 4, 4, 4)); this.add(scp, BorderLayout.CENTER); // buttons JPanel panelButtons = new JPanel(); FlowLayout fl = new FlowLayout(); fl.setAlignment(FlowLayout.LEFT); panelButtons.setLayout(fl); btnDownload = new JButton("Download"); btnDownload.addActionListener(new DownloadHandler()); btnDownload.setEnabled(false); JButton btnCancel = new JButton("Cancel"); btnCancel.addActionListener(new CloseHandler()); lblInfo = new JLabel(""); panelButtons.add(btnDownload); panelButtons.add(btnCancel); panelButtons.add(lblInfo); this.add(panelButtons, BorderLayout.SOUTH); this.pack(); }
From source file:com.petersoft.advancedswing.enhancedtextarea.EnhancedTextArea.java
private void initGUI() { try {/*from ww w . j av a 2s.co m*/ BorderLayout thisLayout = new BorderLayout(); this.setLayout(thisLayout); this.setPreferredSize(new java.awt.Dimension(725, 290)); { jToolBar = new JToolBar(); this.add(jToolBar, BorderLayout.NORTH); { jSaveButton = new JButton(); jToolBar.add(jSaveButton); jSaveButton.setText("Save"); jSaveButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/disk.png"))); jSaveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jSaveButtonActionPerformed(evt); } }); } { jLineWrapButton = new JToggleButton(); jToolBar.add(jLineWrapButton); jLineWrapButton.setText("Wrap"); jLineWrapButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/linewrap.png"))); jLineWrapButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jLineWrapButtonActionPerformed(evt); } }); } { jFontBiggerButton = new JButton(); jToolBar.add(jFontBiggerButton); jFontBiggerButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/font_add.png"))); jFontBiggerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jFontBiggerButtonActionPerformed(evt); } }); } { jFontSmallerButton = new JButton(); jToolBar.add(jFontSmallerButton); jFontSmallerButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/font_delete.png"))); jFontSmallerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jFontSmallerButtonActionPerformed(evt); } }); } { jLabel1 = new JLabel(); jToolBar.add(jLabel1); jLabel1.setText(" "); } { jSearchTextField = new JSearchTextField(); jToolBar.add(jSearchTextField); jSearchTextField.setMaximumSize(new java.awt.Dimension(100, 22)); jSearchTextField.setPreferredSize(new java.awt.Dimension(100, 22)); jSearchTextField.setSize(new java.awt.Dimension(100, 22)); jSearchTextField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent evt) { jSearchTextFieldKeyReleased(evt); } }); } { jSeparatorLabel = new JLabel(); jToolBar.add(jSeparatorLabel); jSeparatorLabel.setText(" "); } { GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[] fonts = e.getAllFonts(); String fontNames[] = new String[fonts.length]; int x = 0; for (Font f : fonts) { fontNames[x++] = f.getFontName(); } ComboBoxModel jFontComboBoxModel = new DefaultComboBoxModel(fontNames); jFontComboBox = new JComboBox(); jToolBar.add(jFontComboBox); jFontComboBox.setModel(jFontComboBoxModel); jFontComboBox.setMaximumSize(new java.awt.Dimension(180, 22)); jFontComboBox.setPreferredSize(new java.awt.Dimension(180, 22)); jFontComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jFontComboBoxActionPerformed(evt); } }); } { pager = new Pager(); jToolBar.add(pager); pager.setVisible(false); } } { jScrollPane1 = new JScrollPane(); this.add(jScrollPane1, BorderLayout.CENTER); { jTextArea = new JTextArea(); jTextArea.getDocument().addDocumentListener(this); lines = new JTextArea(" 1 "); lines.setBackground(new Color(200, 230, 245)); lines.setEditable(false); jScrollPane1.setRowHeaderView(lines); jTextArea.getDocument().addDocumentListener(new DocumentListener() { public String getText() { int caretPosition = jTextArea.getDocument().getLength(); Element root = jTextArea.getDocument().getDefaultRootElement(); int base = 0; if (separateByLine == false) { if (str != null) { base = StringUtils.countMatches( str.substring(0, (pager.getPage() - 1) * pageSize), System.getProperty("line.separator")); if (base == 1) { base = 0; } } } else { base = (pager.getPage() - 1) * pageSize; } base += lineNoBase; String text = " " + (base + 1) + " " + System.getProperty("line.separator"); for (int i = 2; i < root.getElementIndex(caretPosition) + 2; i++) { text += " " + (base + i) + " " + System.getProperty("line.separator"); } return text; } @Override public void changedUpdate(DocumentEvent de) { lines.setText(getText()); } @Override public void insertUpdate(DocumentEvent de) { lines.setText(getText()); } @Override public void removeUpdate(DocumentEvent de) { lines.setText(getText()); } }); jScrollPane1.setViewportView(jTextArea); } } { jStatusPanel = new JPanel(); FlowLayout jStatusPanelLayout = new FlowLayout(); jStatusPanelLayout.setAlignment(FlowLayout.LEFT); jStatusPanel.setLayout(jStatusPanelLayout); this.add(jStatusPanel, BorderLayout.SOUTH); { jStatusLabel = new JLabel(); jStatusPanel.add(jStatusLabel); } { jSearchLabel = new JLabel(); jStatusPanel.add(jSearchLabel); } } this.jFontComboBox.setSelectedItem(jTextArea.getFont().getFamily() + ".plain"); } catch (Exception e) { e.printStackTrace(); } }
From source file:net.sf.profiler4j.console.ProjectDialog.java
/** * This method initializes jPanel/*from ww w. j av a2 s. c o m*/ * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { FlowLayout flowLayout = new FlowLayout(); flowLayout.setAlignment(java.awt.FlowLayout.RIGHT); jPanel = new JPanel(); jPanel.setLayout(flowLayout); jPanel.add(getOkButton(), null); jPanel.add(getJButton(), null); } return jPanel; }
From source file:com.jwmsolutions.timeCheck.gui.TodoForm.java
private JPanel getJPanel6() { if (jPanel6 == null) { jPanel6 = new JPanel(); FlowLayout jPanel6Layout = new FlowLayout(); jPanel6Layout.setAlignment(FlowLayout.RIGHT); jPanel6.setLayout(jPanel6Layout); jPanel6.add(getJlblLink());/*w w w . jav a2 s.c om*/ } return jPanel6; }
From source file:com.jwmsolutions.timeCheck.gui.TodoForm.java
private JPanel getJpnlDateChooser() { if (jpnlDateChooser == null) { jpnlDateChooser = new JPanel(); FlowLayout jpnlDateChooserLayout = new FlowLayout(); jpnlDateChooserLayout.setAlignment(FlowLayout.LEFT); jpnlDateChooser.setLayout(jpnlDateChooserLayout); jpnlDateChooser.add(getJDateChooser_IL()); jpnlDateChooser.add(new JDateChooser(new Date())); }/*from ww w. ja v a2s . c o m*/ return jpnlDateChooser; }