List of usage examples for java.awt Container setLayout
public void setLayout(LayoutManager mgr)
From source file:op.care.med.structure.DlgTradeForm.java
/** * This method is called from within the constructor to * initialize the form.// w ww . j a v a2 s . co m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new JPanel(); txtZusatz = new JTextField(); cmbForm = new JComboBox<>(); panel2 = new JPanel(); btnAdd = new JButton(); hSpacer1 = new JPanel(null); btnEdit = new JButton(); panel4 = new JPanel(); cbExpiresAfterOpened = new JCheckBox(); hSpacer2 = new JPanel(null); txtExpiresIn = new JTextField(); hSpacer3 = new JPanel(null); cmbDaysWeeks = new JComboBox(); cbWeightControlled = new JCheckBox(); panel1 = new JPanel(); btnCancel = new JButton(); btnOK = new JButton(); //======== this ======== setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setResizable(false); setModal(true); Container contentPane = getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS)); //======== jPanel1 ======== { jPanel1.setLayout(new FormLayout( "14dlu, $lcgap, default, $lcgap, default:grow, $lcgap, default, $lcgap, 14dlu", "fill:14dlu, 2*($lgap, fill:default), $lgap, default, 2*($lgap, fill:default), $lgap, 14dlu")); //---- txtZusatz ---- txtZusatz.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(txtZusatz, CC.xywh(3, 3, 5, 1)); //---- cmbForm ---- cmbForm.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbForm.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(cmbForm, CC.xywh(3, 5, 3, 1)); //======== panel2 ======== { panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS)); //---- btnAdd ---- btnAdd.setText(null); btnAdd.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAdd.setBorder(null); btnAdd.setBorderPainted(false); btnAdd.setContentAreaFilled(false); btnAdd.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png"))); btnAdd.addActionListener(e -> btnAddActionPerformed(e)); panel2.add(btnAdd); panel2.add(hSpacer1); //---- btnEdit ---- btnEdit.setText(null); btnEdit.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/edit3.png"))); btnEdit.setBorder(null); btnEdit.setBorderPainted(false); btnEdit.setContentAreaFilled(false); btnEdit.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png"))); btnEdit.addActionListener(e -> btnEditActionPerformed(e)); panel2.add(btnEdit); } jPanel1.add(panel2, CC.xy(7, 5)); //======== panel4 ======== { panel4.setLayout(new BoxLayout(panel4, BoxLayout.X_AXIS)); //---- cbExpiresAfterOpened ---- cbExpiresAfterOpened.setText("expiresAfterOpened"); cbExpiresAfterOpened.addItemListener(e -> cbExpiresAfterOpenedItemStateChanged(e)); panel4.add(cbExpiresAfterOpened); panel4.add(hSpacer2); //---- txtExpiresIn ---- txtExpiresIn.setColumns(10); txtExpiresIn.setEnabled(false); txtExpiresIn.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { txtExpiresInFocusLost(e); } }); panel4.add(txtExpiresIn); panel4.add(hSpacer3); //---- cmbDaysWeeks ---- cmbDaysWeeks.setEnabled(false); cmbDaysWeeks.addItemListener(e -> cmbDaysWeeksItemStateChanged(e)); panel4.add(cmbDaysWeeks); } jPanel1.add(panel4, CC.xywh(3, 7, 5, 1)); //---- cbWeightControlled ---- cbWeightControlled.setText("text"); cbWeightControlled.addItemListener(e -> cbWeightControlledItemStateChanged(e)); jPanel1.add(cbWeightControlled, CC.xywh(3, 9, 5, 1)); //======== panel1 ======== { panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS)); //---- btnCancel ---- btnCancel.setIcon(new ImageIcon(getClass().getResource("/artwork/16x16/cancel.png"))); btnCancel.setText(null); btnCancel.addActionListener(e -> btnCancelActionPerformed(e)); panel1.add(btnCancel); //---- btnOK ---- btnOK.setIcon(new ImageIcon(getClass().getResource("/artwork/16x16/apply.png"))); btnOK.setText(null); btnOK.addActionListener(e -> btnOKActionPerformed(e)); panel1.add(btnOK); } jPanel1.add(panel1, CC.xywh(5, 11, 3, 1, CC.RIGHT, CC.DEFAULT)); } contentPane.add(jPanel1); setSize(425, 220); setLocationRelativeTo(getOwner()); }
From source file:net.openbyte.gui.CreateProjectFrame.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Gary Lee button1 = new JButton(); textField1 = new JTextField(); label1 = new JLabel(); comboBox1 = new JComboBox<>(); label2 = new JLabel(); comboBox2 = new JComboBox<>(); label3 = new JLabel(); button2 = new JButton(); //======== this ======== setTitle("Project Creation"); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setResizable(false);//from ww w . j av a2 s. c o m Container contentPane = getContentPane(); contentPane.setLayout(null); //---- button1 ---- button1.setText("Create project"); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button1ActionPerformed(e); } }); contentPane.add(button1); button1.setBounds(new Rectangle(new Point(340, 170), button1.getPreferredSize())); contentPane.add(textField1); textField1.setBounds(10, 25, 245, textField1.getPreferredSize().height); //---- label1 ---- label1.setText("Project Name"); contentPane.add(label1); label1.setBounds(new Rectangle(new Point(10, 5), label1.getPreferredSize())); //---- comboBox1 ---- comboBox1.setModel(new DefaultComboBoxModel<>(new String[] { "Minecraft Forge", "MCP", "Bukkit" })); comboBox1.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { comboBox1ItemStateChanged(e); } }); contentPane.add(comboBox1); comboBox1.setBounds(10, 70, 245, comboBox1.getPreferredSize().height); //---- label2 ---- label2.setText("Modification API"); contentPane.add(label2); label2.setBounds(new Rectangle(new Point(10, 50), label2.getPreferredSize())); //---- comboBox2 ---- comboBox2.setModel(new DefaultComboBoxModel<>(new String[] { "1.8.9", "1.7.10" })); contentPane.add(comboBox2); comboBox2.setBounds(10, 120, 245, comboBox2.getPreferredSize().height); //---- label3 ---- label3.setText("Minecraft Version"); contentPane.add(label3); label3.setBounds(new Rectangle(new Point(10, 100), label3.getPreferredSize())); //---- button2 ---- button2.setText("Cancel"); button2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button2ActionPerformed(e); } }); contentPane.add(button2); button2.setBounds(new Rectangle(new Point(10, 170), button2.getPreferredSize())); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < contentPane.getComponentCount(); i++) { Rectangle bounds = contentPane.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = contentPane.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; contentPane.setMinimumSize(preferredSize); contentPane.setPreferredSize(preferredSize); } setSize(480, 240); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:omr.jai.TestImage3.java
public TestImage3() { JFrame frame = new JFrame(getClass().getName()); Container pane = frame.getContentPane(); pane.setLayout(new BorderLayout()); pane.add(this); image = decodeImage(new String[] { "#-###############", "-----------------", "#################", "-----------------", "#################", "-----------------", "#################", "-----------------", "#################", "-----------------", "#################", "-----------------", "-----------------", "-----------------", "---####----------", "-------##--------", "---------####----", "-------------#---", "-------------#---", "-----------------", "--#############--", "--#############--", "--#############--", "--#############--", "--#############--", "--#############--", "--#############--", "--#############--", "--#############--", "--#############--", "--#############--", "-----------------", "-----------------", "---####----------", "-------##--------", "---------####----", "-------------#---", "-------------#---", "-----------------", "--#############--", "--#############--", "-----------------", "-----------------" });//from ww w .j a va 2s.com // checkImageFormat(); ImageInfo.print(image); // Scaling final float scale = 1f; ParameterBlock pb = new ParameterBlock() .addSource(image) .add(scale) .add(scale) .add(0f) .add(0f) .add(new InterpolationNearest()); image = JAI.create("scale", pb); dumpPixels(0, 0, 5, 7); if (false) { System.out.println("\nBand Selection"); image = JAI.create("bandselect",image,new int[] {0, 1, 2}); ImageInfo.print(image); dumpPixels(0, 0, 5, 7); } frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(100, 100); frame.pack(); frame.setSize(100, 250); frame.setVisible(true); }
From source file:fungus.JungObserver.java
public JungObserver(String name) { this.name = name; this.hyphadataPid = Configuration.getPid(name + "." + PAR_HYPHADATA_PROTO); this.hyphalinkPid = Configuration.getPid(name + "." + PAR_HYPHALINK_PROTO); this.mycocastPid = Configuration.getPid(name + "." + PAR_MYCOCAST_PROTO); self = this;//w w w .jav a 2 s.com mainThread = Thread.currentThread(); graph = new DirectedSparseGraph<MycoNode, String>(); edu.uci.ics.jung.algorithms.layout.SpringLayout<MycoNode, String> layout = new edu.uci.ics.jung.algorithms.layout.SpringLayout<MycoNode, String>( graph); layout.setSize(new Dimension(650, 650)); layout.setRepulsionRange(75); //layout.setForceMultiplier(0.75); layout.setStretch(0.85); Dimension preferredSize = new Dimension(650, 650); VisualizationModel<MycoNode, String> visualizationModel = new DefaultVisualizationModel<MycoNode, String>( layout, preferredSize); visualizer = new VisualizationViewer<MycoNode, String>(visualizationModel, preferredSize); visualizer.addGraphMouseListener(new InfoFrameVertexListener()); //visualizer = new BasicVisualizationServer<Node,String>(layout); //visualizer.setPreferredSize(new Dimension(650, 650)); Transformer<MycoNode, String> nodeLabeller = new Transformer<MycoNode, String>() { public String transform(MycoNode n) { return Long.toString(n.getID()); } }; final Shape biomassCircle = new Ellipse2D.Float(-2.5f, -2.5f, 5.0f, 5.0f); final Shape hyphaCircle = new Ellipse2D.Float(-5.0f, -5.0f, 10.0f, 10.0f); Transformer<MycoNode, Shape> shapeTransformer = new Transformer<MycoNode, Shape>() { public Shape transform(MycoNode n) { HyphaData data = n.getHyphaData(); if (data.isBiomass()) { return biomassCircle; } else { return hyphaCircle; } } }; Transformer<MycoNode, Paint> nodeFillRenderer = new Transformer<MycoNode, Paint>() { public Paint transform(MycoNode n) { HyphaData data = (HyphaData) n.getProtocol(hyphadataPid); if (!n.isUp()) { return Color.BLACK; } if (data.isBiomass()) { return Color.BLUE; } else if (data.isExtending()) { return Color.RED; } else if (data.isBranching()) { return Color.YELLOW; } else { return Color.GREEN; } } }; Transformer<MycoNode, Paint> nodeShapeRenderer = new Transformer<MycoNode, Paint>() { public Paint transform(MycoNode n) { HyphaData data = (HyphaData) n.getProtocol(hyphadataPid); if (data.isBiomass()) { return Color.BLUE; } else if (data.isExtending()) { return Color.RED; } else if (data.isBranching()) { return Color.YELLOW; } else { return Color.GREEN; } } }; final Stroke biomassStroke = new BasicStroke(0.25f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f); final Stroke hyphalStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f); Transformer<String, Stroke> edgeStrokeTransformer = new Transformer<String, Stroke>() { public Stroke transform(String s) { Pair<MycoNode> vertices = graph.getEndpoints(s); HyphaData firstData = vertices.getFirst().getHyphaData(); HyphaData secondData = vertices.getSecond().getHyphaData(); if (firstData.isHypha() && secondData.isHypha()) { return hyphalStroke; } else { return biomassStroke; } } }; visualizer.getRenderContext().setVertexFillPaintTransformer(nodeFillRenderer); visualizer.getRenderContext().setVertexShapeTransformer(shapeTransformer); visualizer.getRenderContext().setVertexLabelTransformer(nodeLabeller); visualizer.setVertexToolTipTransformer(new ToStringLabeller<MycoNode>()); visualizer.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer); frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = frame.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); //JScrollPane scrollPane = new JScrollPane(visualizer); //c.add(scrollPane); c.add(visualizer); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS)); JButton pauseButton = new JButton("pause"); ActionListener pauser = new ActionListener() { public void actionPerformed(ActionEvent e) { //e.consume(); synchronized (self) { stepBlocked = true; noBlock = false; //self.notifyAll(); } } }; pauseButton.addActionListener(pauser); JButton stepButton = new JButton("step"); ActionListener stepper = new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Clicked!\n"); //e.consume(); synchronized (self) { stepBlocked = false; self.notifyAll(); } } }; stepButton.addActionListener(stepper); JButton runButton = new JButton("run"); ActionListener runner = new ActionListener() { public void actionPerformed(ActionEvent e) { //e.consume(); synchronized (self) { stepBlocked = false; noBlock = true; self.notifyAll(); } } }; runButton.addActionListener(runner); buttonPane.add(pauseButton); buttonPane.add(stepButton); buttonPane.add(runButton); c.add(buttonPane); frame.pack(); frame.setVisible(true); }
From source file:org.kse.gui.crypto.DUpgradeCryptoStrength.java
private void initComponents() { jlUpgradeInstructions = new JLabel(res.getString("DUpgradeCryptoStrength.jlUpgradeInstructions.text")); jlDownloadPolicyInstructions = new JLabel( res.getString("DUpgradeCryptoStrength.jlDownloadPolicyInstructions.text")); jbDownloadPolicy = new JButton(res.getString("DUpgradeCryptoStrength.jbDownloadPolicy.text")); PlatformUtil.setMnemonic(jbDownloadPolicy, res.getString("DUpgradeCryptoStrength.jbDownloadPolicy.mnemonic").charAt(0)); jlDropPolicyInstructions = new JLabel( res.getString("DUpgradeCryptoStrength.jlDropPolicyInstructions.text")); policyZipDropTarget = new PolicyZipDropTarget(); jbBrowsePolicy = new JButton(res.getString("DUpgradeCryptoStrength.jbBrowsePolicy.text")); PlatformUtil.setMnemonic(jbBrowsePolicy, res.getString("DUpgradeCryptoStrength.jbBrowsePolicy.mnemonic").charAt(0)); jbUpgrade = new JButton(res.getString("DUpgradeCryptoStrength.jbUpgrade.text")); PlatformUtil.setMnemonic(jbUpgrade, res.getString("DUpgradeCryptoStrength.jbUpgrade.mnemonic").charAt(0)); jbUpgrade.setEnabled(false);/*from w ww. j av a2s . c o m*/ jbCancel = new JButton(res.getString("DUpgradeCryptoStrength.jbCancel.text")); jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY); jpButtons = PlatformUtil.createDialogButtonPanel(jbUpgrade, jbCancel); // layout Container pane = getContentPane(); pane.setLayout(new MigLayout("insets dialog, fill", "", "[]para[]")); pane.add(jlUpgradeInstructions, "wrap"); pane.add(jlDownloadPolicyInstructions, "wrap"); pane.add(jbDownloadPolicy, "wrap"); pane.add(jlDropPolicyInstructions, "split"); pane.add(policyZipDropTarget, "gap para, pad para, wrap"); pane.add(jbBrowsePolicy, "wrap"); pane.add(new JSeparator(), "spanx, growx, wrap para"); pane.add(jpButtons, "right, spanx"); // actions jbDownloadPolicy.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { try { CursorUtil.setCursorBusy(DUpgradeCryptoStrength.this); downloadPolicyPressed(); } finally { CursorUtil.setCursorFree(DUpgradeCryptoStrength.this); } } }); jbUpgrade.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { upgradePressed(); } }); jbCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { cancelPressed(); } }); jbBrowsePolicy.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { try { CursorUtil.setCursorBusy(DUpgradeCryptoStrength.this); browsePolicyPressed(); } finally { CursorUtil.setCursorFree(DUpgradeCryptoStrength.this); } } }); jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent evt) { cancelPressed(); } }); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent evt) { closeDialog(); } }); setResizable(false); getRootPane().setDefaultButton(jbUpgrade); pack(); }
From source file:edu.clemson.cs.nestbed.client.gui.NetworkMonitorFrame.java
public NetworkMonitorFrame(Testbed testbed, Project project, ProjectDeploymentConfiguration config) throws RemoteException, NotBoundException, MalformedURLException, ClassNotFoundException { super(testbed.getName() + " Network Monitor"); this.testbed = testbed; this.project = project; this.config = config; lookupRemoteManagers();/* w w w.j a va 2s. co m*/ createComponents(); setSize(WINDOW_WIDTH, WINDOW_HEIGHT); Container c = getContentPane(); c.setLayout(new BorderLayout()); c.add(buildMoteGridPanel(), BorderLayout.CENTER); setJMenuBar(buildMenuBar()); }
From source file:net.openbyte.gui.WelcomeFrame.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Gary Lee scrollPane1 = new JScrollPane(); list1 = new JList(); button1 = new JButton(); label2 = new JLabel(); button2 = new JButton(); button3 = new JButton(); button4 = new JButton(); button5 = new JButton(); scrollPane2 = new JScrollPane(); xImagePanel1 = new JXImagePanel(); button6 = new JButton(); button7 = new JButton(); button8 = new JButton(); //======== this ======== setTitle("Welcome to OpenByte"); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setResizable(false);// w ww. j a v a2 s . c o m Container contentPane = getContentPane(); contentPane.setLayout(null); //======== scrollPane1 ======== { scrollPane1.setBorder(new TitledBorder(LineBorder.createGrayLineBorder(), "Recent Projects")); //---- list1 ---- list1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list1.setBackground(new Color(240, 240, 240)); list1.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { list1ValueChanged(e); } }); scrollPane1.setViewportView(list1); } contentPane.add(scrollPane1); scrollPane1.setBounds(15, 10, 165, 340); //---- button1 ---- button1.setText("Open Project"); button1.setEnabled(false); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button1ActionPerformed(e); } }); contentPane.add(button1); button1.setBounds(105, 355, 110, button1.getPreferredSize().height); //---- label2 ---- label2.setText("Media"); contentPane.add(label2); label2.setBounds(new Rectangle(new Point(605, 210), label2.getPreferredSize())); //---- button2 ---- button2.setText("Minecraft Forums"); button2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button2ActionPerformed(e); } }); contentPane.add(button2); button2.setBounds(500, 230, 151, button2.getPreferredSize().height); //---- button3 ---- button3.setText("GitHub"); button3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button3ActionPerformed(e); } }); contentPane.add(button3); button3.setBounds(500, 260, 150, button3.getPreferredSize().height); //---- button4 ---- button4.setText("+"); button4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button4ActionPerformed(e); } }); contentPane.add(button4); button4.setBounds(15, 355, 45, button4.getPreferredSize().height); //---- button5 ---- button5.setText("-"); button5.setEnabled(false); button5.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button5ActionPerformed(e); } }); contentPane.add(button5); button5.setBounds(60, 355, 40, button5.getPreferredSize().height); //======== scrollPane2 ======== { scrollPane2.setBorder(null); scrollPane2.setViewportView(xImagePanel1); } contentPane.add(scrollPane2); scrollPane2.setBounds(210, 25, 445, 160); //---- button6 ---- button6.setText("Preferences"); button6.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button6ActionPerformed(e); } }); contentPane.add(button6); button6.setBounds(500, 290, 150, 30); //---- button7 ---- button7.setText("About"); button7.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button7ActionPerformed(e); } }); contentPane.add(button7); button7.setBounds(500, 320, 150, 30); //---- button8 ---- button8.setText("Plugins"); button8.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button8ActionPerformed(e); } }); contentPane.add(button8); button8.setBounds(500, 350, 150, 30); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < contentPane.getComponentCount(); i++) { Rectangle bounds = contentPane.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = contentPane.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; contentPane.setMinimumSize(preferredSize); contentPane.setPreferredSize(preferredSize); } setSize(675, 425); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:org.hsh.bfr.db.gui.dbtable.editoren.MyChartDialog.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents splitPane1 = new JSplitPane(); scrollPane1 = new JScrollPane(); table1 = new JTable(); panel1 = new JPanel(); button1 = new JButton(); panel2 = new JPanel(); button2 = new JButton(); button3 = new JButton(); button4 = new JButton(); CellConstraints cc = new CellConstraints(); //======== this ======== setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("default:grow", "2*(default, $lgap), default")); //======== splitPane1 ======== {/*from w w w.j av a 2 s. co m*/ splitPane1.setDividerLocation(200); //======== scrollPane1 ======== { scrollPane1.setPreferredSize(new Dimension(200, 423)); //---- table1 ---- table1.setModel( new DefaultTableModel( new Object[][] { { "3.0", "5" }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, }, new String[] { "Zeit (h)", "Temperatur" }) { /** * */ private static final long serialVersionUID = 1L; Class<?>[] columnTypes = new Class<?>[] { String.class, String.class }; @Override public Class<?> getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } }); { TableColumnModel cm = table1.getColumnModel(); cm.getColumn(0).setPreferredWidth(100); } scrollPane1.setViewportView(table1); } splitPane1.setLeftComponent(scrollPane1); //======== panel1 ======== { panel1.setLayout(new FormLayout("default:grow", "fill:default:grow")); //---- button1 ---- button1.setText("text"); panel1.add(button1, cc.xy(1, 1)); } splitPane1.setRightComponent(panel1); } contentPane.add(splitPane1, cc.xy(1, 1)); //======== panel2 ======== { panel2.setLayout(new FormLayout("3*(default:grow, $lcgap), default:grow", "default")); ((FormLayout) panel2.getLayout()).setColumnGroups(new int[][] { { 1, 3, 5, 7 } }); //---- button2 ---- button2.setText("OK"); button2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button2ActionPerformed(e); } }); panel2.add(button2, cc.xy(3, 1)); //---- button3 ---- button3.setText("Abbrechen"); button3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button3ActionPerformed(e); } }); panel2.add(button3, cc.xy(5, 1)); //---- button4 ---- button4.setText("Hilfe"); button4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button4ActionPerformed(e); } }); panel2.add(button4, cc.xy(7, 1)); } contentPane.add(panel2, cc.xy(1, 5)); setSize(555, 390); setLocationRelativeTo(null); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:pcgen.gui2.dialog.ChooserDialog.java
private void initComponents() { setTitle(chooser.getName());//from w w w. j a v a2s . c o m setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { //detach listeners from the chooser treeViewModel.setDelegate(null); listModel.setListFacade(null); chooser.getRemainingSelections().removeReferenceListener(ChooserDialog.this); } }); Container pane = getContentPane(); pane.setLayout(new BorderLayout()); JSplitPane split = new JSplitPane(); JPanel leftPane = new JPanel(new BorderLayout()); if (availTable != null) { availTable.setAutoCreateRowSorter(true); availTable.setTreeViewModel(treeViewModel); availTable.getRowSorter().toggleSortOrder(0); availTable.addActionListener(this); leftPane.add(new JScrollPane(availTable), BorderLayout.CENTER); } else { availInput.addActionListener(this); Dimension maxDim = new Dimension(Integer.MAX_VALUE, availInput.getPreferredSize().height); availInput.setMaximumSize(maxDim); JPanel availPanel = new JPanel(); availPanel.setLayout(new BoxLayout(availPanel, BoxLayout.PAGE_AXIS)); availPanel.add(Box.createRigidArea(new Dimension(10, 30))); availPanel.add(Box.createVerticalGlue()); availPanel.add(new JLabel(LanguageBundle.getString("in_uichooser_value"))); availPanel.add(availInput); availPanel.add(Box.createVerticalGlue()); leftPane.add(availPanel, BorderLayout.WEST); } JPanel buttonPane1 = new JPanel(new FlowLayout()); JButton addButton = new JButton(chooser.getAddButtonName()); addButton.setActionCommand("ADD"); addButton.addActionListener(this); buttonPane1.add(addButton); buttonPane1.add(new JLabel(Icons.Forward16.getImageIcon())); leftPane.add(buttonPane1, BorderLayout.SOUTH); split.setLeftComponent(leftPane); JPanel rightPane = new JPanel(new BorderLayout()); JPanel labelPane = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; labelPane.add(new JLabel(chooser.getSelectionCountName()), new GridBagConstraints()); remainingLabel.setText(chooser.getRemainingSelections().get().toString()); labelPane.add(remainingLabel, gbc); labelPane.add(new JLabel(chooser.getSelectedTableTitle()), gbc); rightPane.add(labelPane, BorderLayout.NORTH); list.setModel(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addActionListener(this); rightPane.add(new JScrollPane(list), BorderLayout.CENTER); JPanel buttonPane2 = new JPanel(new FlowLayout()); buttonPane2.add(new JLabel(Icons.Back16.getImageIcon())); JButton removeButton = new JButton(chooser.getRemoveButtonName()); removeButton.setActionCommand("REMOVE"); removeButton.addActionListener(this); buttonPane2.add(removeButton); rightPane.add(buttonPane2, BorderLayout.SOUTH); split.setRightComponent(rightPane); if (chooser.isInfoAvailable()) { JSplitPane infoSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); infoSplit.setTopComponent(split); infoSplit.setBottomComponent(infoPane); infoSplit.setResizeWeight(0.8); pane.add(infoSplit, BorderLayout.CENTER); if (availTable != null) { availTable.getSelectionModel().addListSelectionListener(this); } } else { pane.add(split, BorderLayout.CENTER); } JPanel bottomPane = new JPanel(new FlowLayout()); JButton button = new JButton(LanguageBundle.getString("in_ok")); //$NON-NLS-1$ button.setMnemonic(LanguageBundle.getMnemonic("in_mn_ok")); //$NON-NLS-1$ button.setActionCommand("OK"); button.addActionListener(this); bottomPane.add(button); button = new JButton(LanguageBundle.getString("in_cancel")); //$NON-NLS-1$ button.setMnemonic(LanguageBundle.getMnemonic("in_mn_cancel")); //$NON-NLS-1$ button.setActionCommand("CANCEL"); button.addActionListener(this); bottomPane.add(button); pane.add(bottomPane, BorderLayout.SOUTH); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.xhtml.PainelXHTML.java
private void criaInterfaceVisualEscalavel() { painel = new JPanel(); textAreaSourceCode = new G_TextAreaSourceCode(); new OnChange(textAreaSourceCode, this); // textAreaSourceCode.getTextPane().addKeyListener(this); textAreaSourceCode.setTipoHTML();//from www . ja va 2s.c o m textAreaSourceCode.setBorder(criaBorda(XHTML_Panel.COD_FONTE)); // frameSilvinha.setTitle(XHTMLPanel.TITULO); // this.frameSilvinha.setTitle(XHTMLPanel.TITULO_XHTML); painel.setLayout(new GridLayout(2, 1)); setBackground(frameSilvinha.corDefault); Container contentPane = this; contentPane.setLayout(new GridLayout(1, 1)); painel.add(textAreaSourceCode); JPanel panelBtnTabela = new JPanel(); panelBtnTabela.setLayout(new BorderLayout()); /* * Barra de botes */ btnPanel = new JPanel(); btnPanel.setLayout(null); btn_salvar = new JButton(XHTML_Panel.BTN_SALVAR); btn_salvar.setBounds(10, 0, 140, 25); btnPanel.add(btn_salvar); btn_abrir = new JButton(XHTML_Panel.BTN_ABRIR); btn_abrir.setBounds(165, 0, 150, 25); btnPanel.add(btn_abrir); btn_salvarComo = new JButton(XHTML_Panel.BTN_SALVAR_COMO); btn_salvarComo.setBounds(325, 0, 150, 25); btnPanel.add(btn_salvarComo); btnPanel.setPreferredSize(new Dimension(760, 30)); btn_cancelar = new JButton(GERAL.TELA_ANTERIOR); btn_cancelar.setBounds(485, 0, 150, 25); btnPanel.add(btn_cancelar); tabelaDeErros = new TabelaErros(); scrollPaneTabela = new JScrollPane(); scrollPaneTabela.setViewportView(tabelaDeErros); panelBtnTabela.add(btnPanel, BorderLayout.NORTH); panelBtnTabela.add(scrollPaneTabela, BorderLayout.CENTER); scrollPaneTabela.setBorder(criaBorda(XHTML_Panel.LISTA_ERROS)); painel.add(panelBtnTabela); btnPanel.setBackground(frameSilvinha.corDefault); reverter = new JButton("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub setVisible(false); TxtBuffer.setContent(TxtBuffer.getContentOriginal()); frameSilvinha.showPainelFerramentaXHTML(); setVisible(true); } }); //reverter.setActionCommand("Reverter"); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); reverter.setBounds(650, 0, 150, 25); btnPanel.add(reverter); panelBtnTabela.setBackground(frameSilvinha.corDefault); painel.setBackground(frameSilvinha.corDefault); contentPane.setBackground(frameSilvinha.corDefault); scrollPaneTabela.setBackground(frameSilvinha.corDefault); textAreaSourceCode.setBackground(frameSilvinha.corDefault); miBtnSalvar.setEnabled(false); btn_salvar.setEnabled(false); contentPane.add(painel); // pack(); this.setVisible(true); }