private void createView() { JPanel controlsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10)); serverTextField = new JTextField(""); serverTextField.setColumns(15); serverTextField.selectAll(); JPanel textPanel = new JPanel(new GridLayout(4, 2, 0, 10)); textPanel.add(new JLabel("Go Server Hostname or IP")); textPanel.add(serverTextField); textPanel.add(new JLabel("SSL Mode")); sslModeComponent = new SslModeComponent(); textPanel.add(sslModeComponent); textPanel.add(new JLabel("Server root certificate")); fileBrowser = new FileBrowser(); textPanel.add(fileBrowser); controlsPanel.add(textPanel); getContentPane().add(controlsPanel, BorderLayout.NORTH); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10)); okButton = new JButton("OK"); buttonPanel.add(okButton); getContentPane().add(buttonPanel, BorderLayout.SOUTH); }
@PostConstruct protected void init() { setLayout(new BorderLayout(RESTView.BORDER_WIDTH, RESTView.BORDER_WIDTH)); JLabel jl_res_statusLine = new JLabel("Status: "); add(jl_res_statusLine, BorderLayout.WEST); jtf.setColumns(35); jtf.setEditable(false); add(jtf, BorderLayout.CENTER); }
c.setLayout(new BorderLayout()); JPanel jp_center = new JPanel(); jp_center.setBorder(BorderFactory.createTitledBorder("Run Test")); jp_center.setLayout(new GridLayout(3, 1)); jp_center.add(jrb_archive); JPanel jp_center_file = new JPanel(); jp_center_file.setLayout(new FlowLayout()); jtf_archive.setColumns(24); jtf_archive.setEditable(false); jp_center_file.add(jtf_archive); jb_archive_browse.setMnemonic('b'); jb_archive_browse.addActionListener(new ActionListener() { jp_center_file.add(jb_archive_browse); jp_center.add(jp_center_file); jp_center.add(jrb_last); c.add(jp_center, BorderLayout.CENTER); JPanel jp_south = new JPanel(); jp_south.setLayout(new FlowLayout(FlowLayout.RIGHT)); jb_next.setMnemonic('n'); jp_south.add(jb_cancel); c.add(jp_south, BorderLayout.SOUTH);
@NotNull private JPanel createRowLimitPanel() { rowLimitField.setText(Integer.toString(configuration.getDefaultRowLimit())); rowLimitField.setColumns(5); rowLimitField.setDocument(new NumberDocument()); rowLimitField.setText(Integer.toString(configuration.getDefaultRowLimit())); JPanel rowLimitPanel = new NonOpaquePanel(); rowLimitPanel.add(new JLabel("Row limit:"), BorderLayout.WEST); rowLimitPanel.add(rowLimitField, BorderLayout.CENTER); rowLimitPanel.add(Box.createHorizontalStrut(5), BorderLayout.EAST); return rowLimitPanel; }
protected void createFilterField() { $objectMap.put("filterField", filterField = new JTextField()); filterField.setName("filterField"); filterField.setColumns(15); }
import java.awt.FlowLayout; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JTextField; public class TextFieldExample extends JFrame { JFrame frame = new JFrame(); public TextFieldExample() { frame = new JFrame("Test"); Container container = frame.getContentPane(); JTextField fld1 = new JTextField("Java C++ C"); JTextField fld2 = new JTextField(""); JTextField fld3 = new JTextField(""); fld1.setColumns(5); //Now, it will not be resized. fld2.setColumns(7); //Now, it will not be resized. fld3.setColumns(9); //Now, it will not be resized. container.setLayout(new FlowLayout()); container.add(fld1); container.add(fld2); container.add(fld3); frame.setVisible(true); frame.setSize(150,150); } public static void main(String[] args) { TextFieldExample obj = new TextFieldExample(); } }
String labels[] = {"Won", "Draw", "Lost"}; JLabel label; for (int i =0; i<labels.length; i++) { label = new JLabel(labels[i]); label.setBounds(5, 10 + (i * 45), 50, 16); mainframe.add(label); } JTextField jTextField; int txtFieldCount = 3; for (int i=0 ;i<txtFieldCount; i++) { jTextField = new JTextField(); jTextField.setBounds(168, 4 + (i * 45), 134, 28); mainframe.add(jTextField); jTextField.setColumns(10); }
import javax.swing.JFormattedTextField; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import java.awt.FlowLayout; public class MainClass extends JFrame { private JPanel contentPane; private JFormattedTextField MyTextField; public static void main(String[] args) { new MainClass(); } public MainClass() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); MyTextField=new JFormattedTextField(); MyTextField.setColumns(20); MyTextField.getDocument().addDocumentListener(new MyDocumentListener()); contentPane.add(MyTextField); this.setVisible(true); } }
private void createComponents() { final IServerMessenger messenger = model.getMessenger(); final Color backGround = new JTextField().getBackground(); portField = new JTextField("" + messenger.getLocalNode().getPort()); portField.setEnabled(true); portField.setEditable(false); portField.setBackground(backGround); portField.setColumns(6); addressField = new JTextField(messenger.getLocalNode().getAddress().getHostAddress()); addressField.setEnabled(true); addressField.setEditable(false); addressField.setBackground(backGround); addressField.setColumns(20); nameField = new JTextField(messenger.getLocalNode().getName()); nameField.setEnabled(true); nameField.setEditable(false); nameField.setBackground(backGround); nameField.setColumns(20); info = new JPanel(); networkPanel = new JPanel(); }
private JPanel makeSettingsPanel(JButton browseButton, JButton goButton, JButton cxButton) { JPanel settingsPanel = new JPanel(); GridBagHelper helper = new GridBagHelper(settingsPanel, new double[] { 0.2, 0.7, 0.1, 0.1 }); helper.addLabel("Root source directory:"); helper.nextRow(); helper.addLabel("Report duplicate chunks larger than:"); minimumLengthField.setColumns(4); helper.add(minimumLengthField); helper.addLabel("Language:"); encodingField.setColumns(1); helper.add(encodingField); helper.addLabel("");
java.awt.GridBagConstraints gridBagConstraints; jLabel1 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 3; getContentPane().add(jLabel1, gridBagConstraints); jTextField1.setColumns(13); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; getContentPane().add(jTextField1, gridBagConstraints); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; getContentPane().add(jLabel2, gridBagConstraints);
@Override public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { Component c = super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row); DirectoryNode node = (DirectoryNode)value; editorPanel.setOpaque(false); editorPanel.add(new JLabel(fileChooser.getIcon(node.getFile())), BorderLayout.CENTER); editorPanel.add(c, BorderLayout.EAST); textField = (JTextField)getComponent(); String text = fileChooser.getName(node.getFile()); textField.setText(text); textField.setColumns(text.length()); return editorPanel; }
protected void createFieldPopulationBasicsNbClasses() { $objectMap.put("fieldPopulationBasicsNbClasses", fieldPopulationBasicsNbClasses = new JTextField()); fieldPopulationBasicsNbClasses.setName("fieldPopulationBasicsNbClasses"); fieldPopulationBasicsNbClasses.setColumns(15); fieldPopulationBasicsNbClasses.setEditable(false); }
import javax.swing.JFrame; import javax.swing.JTextField; import java.awt.Container; import java.awt.EventQueue; import java.awt.FlowLayout; public class TextFieldWithFlowLayout { public static void main( String[] args ) { EventQueue.invokeLater( new Runnable() { @Override public void run() { JFrame console = new JFrame("ArchiveConsole"); Container base = console.getContentPane(); base.setLayout(new FlowLayout( FlowLayout.CENTER, 5,5)); JTextField tf = new JTextField(); tf.setColumns( 20 ); base.add(tf); console.pack(); console.setVisible(true); } } ); } }
public BottomInfoPanel() { FlowLayout flowLayout = (FlowLayout) getLayout(); flowLayout.setAlignment(FlowLayout.LEFT); JLabel lblX = new JLabel("X:"); add(lblX); txtX = new JTextField(); add(txtX); txtX.setColumns(10); JLabel lblY = new JLabel("Y:"); add(lblY); txtY = new JTextField(); add(txtY); txtY.setColumns(10); lblZoom = new JLabel("Zoom:"); add(lblZoom); txtZoom = new JTextField(); add(txtZoom); txtZoom.setColumns(10); }
public OptionEditor() { groupButtons(byCalled, byCaller); final JPanel directionPanel = columns(new JLabel("Direction: "), byCaller, byCalled, new JLabel("")); groupButtons(valueWidth, logWidth, equalWidth); final JPanel widthPanel = columns(new JLabel("Cell width: "), valueWidth, logWidth, equalWidth); statLimit.setColumns(3); final JPanel displaySettingsPanel = columns( stackWest(new JLabel("Drop frames less than"), statLimit, new JLabel("%")), byValue); final JPanel graphPanel = titled("Graph generation options", stackNorth(directionPanel, widthPanel, displaySettingsPanel)); ///// final JPanel bottomPanel = stackSouth(flow(apply), graphPanel); setLayout(new BorderLayout()); add(bottomPanel, BorderLayout.SOUTH); }
private JPanel createPnlLineLimit() { GridBagConstraints gbc; JPanel pnlLineLimit = new JPanel(new GridBagLayout()); gbc = new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,5,5), 0,0); pnlLineLimit.add(_chkTextLimitLineVisible, gbc); gbc = new GridBagConstraints(1,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,5,5,5), 0,0); pnlLineLimit.add(new JLabel(i18n.TEXT_LIMIT_LINE_WIDTH), gbc); _txtTextLimitLineWidth.setColumns(3); gbc = new GridBagConstraints(2,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,5,5), 0,0); pnlLineLimit.add(_txtTextLimitLineWidth, gbc); return pnlLineLimit; }
protected void createFieldPopulationGroupMaturityOgive() { $objectMap.put("fieldPopulationGroupMaturityOgive", fieldPopulationGroupMaturityOgive = new JTextField()); fieldPopulationGroupMaturityOgive.setName("fieldPopulationGroupMaturityOgive"); fieldPopulationGroupMaturityOgive.setColumns(15); fieldPopulationGroupMaturityOgive.setEnabled(false); }
textField = new JTextField(); textField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(textField, BorderLayout.CENTER); textField.setColumns(10); pack(); setVisible(true);
private void createReport(JPanel aPanel, String aMessage, Double aValue) { aPanel.add(new JLabel(aMessage, SwingConstants.TRAILING)); final JTextField txf = new JTextField(Utils.doubleToString(aValue, 6, 3)); txf.setEditable(false); txf.setColumns(9); aPanel.add(txf); }