List of usage examples for javax.swing BoxLayout Y_AXIS
int Y_AXIS
To view the source code for javax.swing BoxLayout Y_AXIS.
Click Source Link
From source file:nz.govt.natlib.ndha.manualdeposit.StructMapFileDescManagement.java
private void initComponents() { scrlDescription = new javax.swing.JScrollPane(); lstDescription = new javax.swing.JList(); pnlDetails = new javax.swing.JPanel(); btnMoveUp = new javax.swing.JButton(); btnMoveDown = new javax.swing.JButton(); btnAddNew = new javax.swing.JButton(); btnDelete = new javax.swing.JButton(); btnSave = new javax.swing.JButton(); btnCancel = new javax.swing.JButton(); btnClose = new javax.swing.JButton(); btnGenMainDesc = new javax.swing.JButton(); setTitle("Manage Structure Map File Descriptions"); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt);//from w ww . jav a 2 s . c o m } public void windowClosing(java.awt.event.WindowEvent evt) { dialogWindowClosing(evt); } }); scrlDescription.setViewportView(lstDescription); JPanel panelLayer1 = new JPanel(); panelLayer1.setAlignmentY(Component.TOP_ALIGNMENT); panel_ExtraLayers = new JPanel(); panel_ExtraLayers.setAlignmentY(Component.TOP_ALIGNMENT); panel_ExtraLayers.setMinimumSize(new Dimension(300, 0)); panel_ExtraLayers.setPreferredSize(new Dimension(300, 500)); panel_ExtraLayers.setMaximumSize(new Dimension(300, 500)); panel_ExtraLayers.setVisible(false); JLabel lblDescriptionL2 = new JLabel("Layer 2"); lblDescriptionL2.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_1 = new JLabel("Description"); textfldDescriptionL2 = new JTextField(); textfldDescriptionL2.setName("DescriptionL2"); textfldDescriptionL2.setColumns(10); JLabel lblFilePrefixL2 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL2 = new JTextField(); textfldFilePrefixL2.setName("FilePrefixL2"); textfldFilePrefixL2.setColumns(10); JLabel lblAllowMultiplesL2 = new JLabel("Allow Multiples?"); checkAllowMultiplesL2 = new JCheckBox(""); checkAllowMultiplesL2.setName("AllowMultiplesL2"); JLabel lblDescriptionL3 = new JLabel("Layer 3"); lblDescriptionL3.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_2 = new JLabel("Description"); textfldDescriptionL3 = new JTextField(); textfldDescriptionL3.setName("DescriptionL3"); textfldDescriptionL3.setColumns(10); JLabel lblFilePrefixL3 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL3 = new JTextField(); textfldFilePrefixL3.setName("FilePrefixL3"); textfldFilePrefixL3.setColumns(10); JLabel lblAllowMultiplesL3 = new JLabel("Allow Multiples?"); checkAllowMultiplesL3 = new JCheckBox(""); checkAllowMultiplesL3.setName("AllowMultiplesL3"); JLabel lblDescriptionL4 = new JLabel("Layer 4"); lblDescriptionL4.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_3 = new JLabel("Description"); textfldDescriptionL4 = new JTextField(); textfldDescriptionL4.setName("DescriptionL4"); textfldDescriptionL4.setColumns(10); lblFilePrefixL4 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL4 = new JTextField(); textfldFilePrefixL4.setName("FilePrefixL4"); textfldFilePrefixL4.setColumns(10); lblAllowMultiplesL4 = new JLabel("Allow Multiples?"); checkAllowMultiplesL4 = new JCheckBox(""); checkAllowMultiplesL4.setName("AllowMultiplesL4"); GroupLayout gl_panel_ExtraLayers = new GroupLayout(panel_ExtraLayers); gl_panel_ExtraLayers .setHorizontalGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup().addContainerGap() .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addComponent(lblDescriptionL2) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblDescription_1).addGap(44) .addComponent(textfldDescriptionL2, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblFilePrefixL2).addGap(18) .addComponent(textfldFilePrefixL2, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblAllowMultiplesL2).addGap(18) .addComponent(checkAllowMultiplesL2)) .addComponent(lblDescriptionL3) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(lblDescription_2) .addComponent(lblFilePrefixL3) .addComponent(lblAllowMultiplesL3)) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGap(21) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(textfldFilePrefixL3, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE) .addComponent( textfldDescriptionL3, GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE))) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGap(18) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(textfldDescriptionL4, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE) .addGroup(gl_panel_ExtraLayers .createSequentialGroup() .addComponent(checkAllowMultiplesL3) .addPreferredGap( ComponentPlacement.RELATED, 172, Short.MAX_VALUE)))))) .addComponent(lblDescriptionL4).addComponent(lblDescription_3) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblFilePrefixL4).addGap(18) .addComponent(textfldFilePrefixL4, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblAllowMultiplesL4).addGap(18) .addComponent(checkAllowMultiplesL4))) .addContainerGap())); gl_panel_ExtraLayers.setVerticalGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup().addContainerGap() .addComponent(lblDescriptionL2).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_1) .addComponent(textfldDescriptionL2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL2) .addComponent(textfldFilePrefixL2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblAllowMultiplesL2).addComponent(checkAllowMultiplesL2)) .addGap(18).addComponent(lblDescriptionL3).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_2) .addComponent(textfldDescriptionL3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL3) .addComponent(textfldFilePrefixL3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addComponent(lblAllowMultiplesL3).addComponent(checkAllowMultiplesL3)) .addGap(18).addComponent(lblDescriptionL4).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_3) .addComponent(textfldDescriptionL4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL4) .addComponent(textfldFilePrefixL4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblAllowMultiplesL4).addComponent(checkAllowMultiplesL4)) .addContainerGap(39, Short.MAX_VALUE))); panel_ExtraLayers.setLayout(gl_panel_ExtraLayers); lblDescription = new JLabel(); lblDescription.setText("Description"); textfldDescription = new JTextField(); textfldDescription.setName("Description"); textfldFilePrefix = new JTextField(); textfldFilePrefix.setName("FilePrefix"); lblFilePrefix = new JLabel(); lblFilePrefix.setText("File Prefix/Suffix"); lblPosition = new JLabel(); lblPosition.setText("Position"); cmbPosition = new JComboBox(); cmbPosition.setName("Position"); lblMandatory = new JLabel(); lblMandatory.setText("Mandatory?"); checkMandatory = new JCheckBox(); checkMandatory.setName("Mandatory"); lblAllowMultiples = new JLabel(); lblAllowMultiples.setText("Allow Multiples?"); checkAllowMultiples = new JCheckBox(); checkAllowMultiples.setName("AllowMultiples"); lblExtraLayers = new JLabel("Extra Layers?"); checkExtraLayers = new JCheckBox(""); checkExtraLayers.setName("ExtraLayers"); checkExtraLayers.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { JCheckBox button = (JCheckBox) e.getSource(); if (button.isSelected()) { panel_MainDesc.setVisible(true); panel_ExtraLayers.setVisible(true); pnlDetails.revalidate(); pnlDetails.repaint(); } else { panel_MainDesc.setVisible(false); panel_ExtraLayers.setVisible(false); pnlDetails.revalidate(); pnlDetails.repaint(); } } }); GroupLayout gl_panelLayer1 = new GroupLayout(panelLayer1); gl_panelLayer1.setHorizontalGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelLayer1.createSequentialGroup().addContainerGap() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelLayer1.createSequentialGroup() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(lblFilePrefix).addComponent(lblDescription) .addComponent(lblPosition)) .addGap(18) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(textfldFilePrefix, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addComponent(textfldDescription, GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE) .addComponent(cmbPosition, 0, 169, Short.MAX_VALUE))) .addGroup( gl_panelLayer1.createSequentialGroup() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(lblAllowMultiples) .addComponent(lblExtraLayers).addComponent(lblMandatory)) .addGap(18) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkExtraLayers).addComponent(checkMandatory) .addComponent(checkAllowMultiples)))) .addContainerGap())); gl_panelLayer1 .setVerticalGroup(gl_panelLayer1.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING, gl_panelLayer1.createSequentialGroup().addGap(24) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription) .addComponent(textfldDescription, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1 .createParallelGroup(Alignment.BASELINE).addComponent(lblFilePrefix) .addComponent(textfldFilePrefix, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblPosition) .addComponent(cmbPosition, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(8) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkMandatory).addComponent(lblMandatory)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkAllowMultiples).addComponent(lblAllowMultiples)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblExtraLayers).addComponent(checkExtraLayers)) .addContainerGap(26, Short.MAX_VALUE))); panelLayer1.setLayout(gl_panelLayer1); btnMoveUp.setPreferredSize(new java.awt.Dimension(91, 23)); btnMoveUp.setText("Move Up"); btnMoveDown.setText("Move Down"); btnAddNew.setText("Add New"); btnDelete.setText("Delete"); btnSave.setText("Save"); btnCancel.setText("Cancel"); btnClose.setText("Close"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.TRAILING).addGroup(layout.createSequentialGroup() .addComponent(scrlDescription, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE).addGap(18) .addGroup(layout.createParallelGroup(Alignment.TRAILING) .addGroup(layout.createSequentialGroup().addComponent(btnAddNew).addGap(18) .addComponent(btnDelete, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE) .addGap(19)) .addComponent(pnlDetails, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addComponent(btnMoveUp, GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnMoveDown, GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE).addGap(89) .addComponent(btnSave, GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(btnCancel, GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(btnClose, GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup() .addComponent(pnlDetails, GroupLayout.PREFERRED_SIZE, 597, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(btnDelete) .addComponent(btnAddNew))) .addComponent(scrlDescription, GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)) .addGap(18) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(btnMoveUp, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btnMoveDown)) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(btnClose) .addComponent(btnCancel).addComponent(btnSave))) .addContainerGap())); pnlDetails.setLayout(new BoxLayout(pnlDetails, BoxLayout.Y_AXIS)); panel_MainDesc = new JPanel(); panel_MainDesc.setMinimumSize(new Dimension(300, 0)); panel_MainDesc.setPreferredSize(new Dimension(300, 60)); panel_MainDesc.setMaximumSize(new Dimension(300, 60)); panel_MainDesc.setVisible(false); lblDescriptionMain = new JLabel("Main Description"); textfldDescriptionMain = new JTextField(); textfldDescriptionMain.setName("DescriptionMain"); textfldDescriptionMain.setColumns(10); btnGenMainDesc_1 = new JButton(""); btnGenMainDesc_1.setToolTipText("Generate a main description by concatenating layer descriptions."); btnGenMainDesc_1.setContentAreaFilled(false); btnGenMainDesc_1.setIcon(new ImageIcon(StructMapFileDescManagement.class .getResource("/org/jdesktop/swingx/plaf/basic/resources/month-down.png"))); GroupLayout gl_panel_MainDesc = new GroupLayout(panel_MainDesc); gl_panel_MainDesc.setHorizontalGroup(gl_panel_MainDesc.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_MainDesc.createSequentialGroup().addContainerGap() .addComponent(lblDescriptionMain).addGap(18) .addComponent(textfldDescriptionMain, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnGenMainDesc_1, GroupLayout.PREFERRED_SIZE, 25, Short.MAX_VALUE) .addContainerGap())); gl_panel_MainDesc.setVerticalGroup(gl_panel_MainDesc.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_MainDesc.createSequentialGroup().addContainerGap().addGroup(gl_panel_MainDesc .createParallelGroup(Alignment.LEADING) .addComponent(btnGenMainDesc_1, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panel_MainDesc.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescriptionMain).addComponent(textfldDescriptionMain, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_MainDesc.setLayout(gl_panel_MainDesc); pnlDetails.add(panel_MainDesc); pnlDetails.add(panelLayer1); pnlDetails.add(panel_ExtraLayers); getContentPane().setLayout(layout); pack(); }
From source file:op.care.prescription.PnlPrescription.java
private java.util.List<Component> addFilters() { java.util.List<Component> list = new ArrayList<Component>(); tbClosed = GUITools.getNiceToggleButton("nursingrecords.prescription.showclosed"); tbClosed.addItemListener(new ItemListener() { @Override/*from w w w.j a va2s. com*/ public void itemStateChanged(ItemEvent e) { reloadDisplay(); } }); tbClosed.setHorizontalAlignment(SwingConstants.LEFT); list.add(tbClosed); if (!listUsedCommontags.isEmpty()) { JPanel pnlTags = new JPanel(); pnlTags.setLayout(new BoxLayout(pnlTags, BoxLayout.Y_AXIS)); pnlTags.setOpaque(false); for (final Commontags commontag : listUsedCommontags) { final JButton btnTag = GUITools.createHyperlinkButton(commontag.getText(), SYSConst.icon16tagPurple, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SYSFilesTools.print(PrescriptionTools.getPrescriptionsAsHTML( PrescriptionTools.getPrescriptions4Tags(resident, commontag), true, true, false, tbClosed.isSelected(), true), true); } }); btnTag.setForeground(GUITools.getColor(commontag.getColor())); pnlTags.add(btnTag); } list.add(pnlTags); } return list; }
From source file:op.care.reports.PnlReport.java
private java.util.List<Component> addFilters() { java.util.List<Component> list = new ArrayList<Component>(); txtSearch = new JXSearchField(SYSTools.xx("misc.msg.searchphrase")); txtSearch.setInstantSearchDelay(100000); txtSearch.setFont(SYSConst.ARIAL14); txtSearch.addActionListener(new ActionListener() { @Override/* w ww. j av a 2s. c o m*/ public void actionPerformed(ActionEvent e) { if (SYSTools.catchNull(txtSearch.getText()).trim().length() >= 3) { SYSFilesTools.print(NReportTools.getNReportsAsHTML( NReportTools.getNReports4Search(resident, txtSearch.getText().trim()), true, SYSTools.xx("misc.msg.searchresults") + ": "" + txtSearch.getText().trim() + """, txtSearch.getText().trim()), false); } } }); list.add(txtSearch); tbShowReplaced = GUITools.getNiceToggleButton(SYSTools.xx("misc.filters.showreplaced")); tbShowReplaced.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent itemEvent) { if (initPhase) return; reloadDisplay(); } }); list.add(tbShowReplaced); tbShowReplaced.setHorizontalAlignment(SwingConstants.LEFT); // ArrayList<Commontags> listTags = listUsedCommonTags; if (!listUsedCommontags.isEmpty()) { JPanel pnlTags = new JPanel(); pnlTags.setLayout(new BoxLayout(pnlTags, BoxLayout.Y_AXIS)); pnlTags.setOpaque(false); for (final Commontags commontag : listUsedCommontags) { final JButton btnTag = GUITools.createHyperlinkButton(commontag.getText(), SYSConst.icon16tagPurple, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SYSFilesTools.print(NReportTools.getNReportsAsHTML( NReportTools.getNReports4Tags(resident, commontag), true, null, null), false); } }); btnTag.setForeground(GUITools.getColor(commontag.getColor())); pnlTags.add(btnTag); } list.add(pnlTags); } return list; }
From source file:oqm.network.view.JUNGPanelAdapter.java
/** * Create an instance of a simple graph with popup controls to * create a graph.//from ww w . j av a2s .co m * */ public JUNGPanelAdapter(double[][] system) { this.system = system; this.decimalFormatter = new DecimalFormat(decFormat); this.setPreferredSize(new Dimension(600, 400)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // create a simple graph for the demo graph = new DirectedSparseMultigraph<MyNode, MyLink>(); this.layout = new StaticLayout<MyNode, MyLink>(graph, new Dimension(600, 600)); if (this.system.length > 0) { createVerticies(); drawEdges(); drawVerticies(); } vv = new VisualizationViewer<MyNode, MyLink>(layout); vv.setBackground(Color.white); vv.getRenderContext().setVertexLabelTransformer(MapTransformer.<MyNode, String>getInstance( LazyMap.<MyNode, String>decorate(new HashMap<MyNode, String>(), new ToStringLabeller<MyNode>()))); vv.getRenderContext().setEdgeLabelTransformer(MapTransformer.<MyLink, String>getInstance( LazyMap.<MyLink, String>decorate(new HashMap<MyLink, String>(), new ToStringLabeller<MyLink>()))); vv.setVertexToolTipTransformer(vv.getRenderContext().getVertexLabelTransformer()); vv.getRenderer().getVertexLabelRenderer().setPosition(Position.N); //vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); this.add(panel); final EditingModalGraphMouse<MyNode, MyLink> graphMouse = new EditingModalGraphMouse<MyNode, MyLink>( vv.getRenderContext(), vertexFactory, edgeFactory); // the EditingGraphMouse will pass mouse event coordinates to the // vertexLocations function to set the locations of the vertices as // they are created // graphMouse.setVertexLocations(vertexLocations); vv.setGraphMouse(graphMouse); vv.addKeyListener(graphMouse.getModeKeyListener()); graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JButton help = new JButton("Help"); help.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(vv, instructions); } }); AnnotationControls<MyNode, MyLink> annotationControls = new AnnotationControls<MyNode, MyLink>( graphMouse.getAnnotatingPlugin()); JPanel controls = new JPanel(); controls.add(plus); controls.add(minus); JComboBox modeBox = graphMouse.getModeComboBox(); controls.add(modeBox); controls.add(annotationControls.getAnnotationsToolBar()); controls.add(help); this.add(controls); this.setVisible(true); }
From source file:org.apache.commons.jelly.demos.HomepageBuilder.java
public HomepageBuilder() { System.out.println("Starting Homepage Builder"); JPanel leftPanel = new JPanel(); leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS)); leftPanel.add(new JLabel("Name:")); nameField = new JTextField("James Bond"); leftPanel.add(nameField);//from w ww .j a v a2 s. c o m leftPanel.add(new JLabel("Favorite Color:")); colorField = new JTextField("#007007"); leftPanel.add(colorField); leftPanel.add(new JLabel("Picture URL:")); urlField = new JTextField("http://www.ianfleming.org/007news/images3/c2002_pierce1.jpg"); leftPanel.add(urlField); leftPanel.add(new JLabel("Choose template:")); templateList = new JComboBox(new String[] { "template1.jelly", "template2.jelly" }); leftPanel.add(templateList); // JPanel rightPanel = new JPanel(); // rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS)); leftPanel.add(new JLabel("Add a Hobby:")); addField = new JTextField(); leftPanel.add(addField); JButton addButton = new JButton("Add >>>"); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { listModel.addElement(addField.getText()); } }); leftPanel.add(addButton); listModel = new DefaultListModel(); listModel.addElement("Killing bad guys"); listModel.addElement("Wrecking cars"); listModel.addElement("Eating jelly"); interestList = new JList(listModel); JButton submit = new JButton("Build and preview your page!"); submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { buildPage(templateList.getSelectedItem().toString(), new JellyContext()); showPage(); } }); // Layout the demo setLayout(new BorderLayout()); add(submit, BorderLayout.SOUTH); add(leftPanel, BorderLayout.WEST); add(new JScrollPane(interestList), BorderLayout.EAST); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:org.apache.jmeter.gui.action.SearchTreeDialog.java
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) this.getContentPane().setLayout(new BorderLayout(10, 10)); searchTF = new JLabeledTextField(JMeterUtils.getResString("search_text_field"), 20); //$NON-NLS-1$ if (!StringUtils.isEmpty(lastSearch)) { searchTF.setText(lastSearch);//from ww w. java 2s .c o m } isRegexpCB = new JCheckBox(JMeterUtils.getResString("search_text_chkbox_regexp"), false); //$NON-NLS-1$ isCaseSensitiveCB = new JCheckBox(JMeterUtils.getResString("search_text_chkbox_case"), false); //$NON-NLS-1$ isRegexpCB.setFont(FONT_SMALL); isCaseSensitiveCB.setFont(FONT_SMALL); JPanel searchCriterionPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); searchCriterionPanel.add(isCaseSensitiveCB); searchCriterionPanel.add(isRegexpCB); JPanel searchPanel = new JPanel(); searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.Y_AXIS)); searchPanel.setBorder(BorderFactory.createEmptyBorder(7, 3, 3, 3)); searchPanel.add(searchTF, BorderLayout.NORTH); searchPanel.add(searchCriterionPanel, BorderLayout.CENTER); JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); searchButton = new JButton(JMeterUtils.getResString("search")); //$NON-NLS-1$ searchButton.addActionListener(this); searchAndExpandButton = new JButton(JMeterUtils.getResString("search_expand")); //$NON-NLS-1$ searchAndExpandButton.addActionListener(this); cancelButton = new JButton(JMeterUtils.getResString("cancel")); //$NON-NLS-1$ cancelButton.addActionListener(this); buttonsPanel.add(searchButton); buttonsPanel.add(searchAndExpandButton); buttonsPanel.add(cancelButton); searchPanel.add(buttonsPanel, BorderLayout.SOUTH); this.getContentPane().add(searchPanel); searchTF.requestFocusInWindow(); this.pack(); ComponentUtil.centerComponentInWindow(this); }
From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGui.java
private void init() {// called from ctor, so must not be overridable this.setLayout(new BorderLayout()); // WEB REQUEST PANEL JPanel webRequestPanel = new JPanel(); webRequestPanel.setLayout(new BorderLayout()); webRequestPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils.getResString("web_request"))); // $NON-NLS-1$ JPanel northPanel = new JPanel(); northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS)); northPanel.add(getProtocolAndMethodPanel()); northPanel.add(getPathPanel());// w w w . j a v a 2 s . c o m webRequestPanel.add(northPanel, BorderLayout.NORTH); webRequestPanel.add(getParameterPanel(), BorderLayout.CENTER); this.add(getWebServerTimeoutPanel(), BorderLayout.NORTH); this.add(webRequestPanel, BorderLayout.CENTER); this.add(getProxyServerPanel(), BorderLayout.SOUTH); }
From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGui.java
/** * This method defines the Panel for the HTTP path, 'Follow Redirects' * 'Use KeepAlive', and 'Use multipart for HTTP POST' elements. * * @return JPanel The Panel for the path, 'Follow Redirects' and 'Use * KeepAlive' elements.// w ww . jav a2 s. co m */ protected Component getPathPanel() { path = new JTextField(15); JLabel label = new JLabel(JMeterUtils.getResString("path")); //$NON-NLS-1$ label.setLabelFor(path); if (notConfigOnly) { followRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects")); // $NON-NLS-1$ followRedirects.setFont(null); followRedirects.setSelected(true); followRedirects.addChangeListener(this); autoRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects_auto")); //$NON-NLS-1$ autoRedirects.setFont(null); autoRedirects.addChangeListener(this); autoRedirects.setSelected(false);// Default changed in 2.3 and again in 2.4 useKeepAlive = new JCheckBox(JMeterUtils.getResString("use_keepalive")); // $NON-NLS-1$ useKeepAlive.setFont(null); useKeepAlive.setSelected(true); useMultipartForPost = new JCheckBox(JMeterUtils.getResString("use_multipart_for_http_post")); // $NON-NLS-1$ useMultipartForPost.setFont(null); useMultipartForPost.setSelected(false); useBrowserCompatibleMultipartMode = new JCheckBox( JMeterUtils.getResString("use_multipart_mode_browser")); // $NON-NLS-1$ useBrowserCompatibleMultipartMode.setFont(null); useBrowserCompatibleMultipartMode .setSelected(HTTPSamplerBase.BROWSER_COMPATIBLE_MULTIPART_MODE_DEFAULT); } JPanel pathPanel = new HorizontalPanel(); pathPanel.add(label); pathPanel.add(path); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(pathPanel); if (notConfigOnly) { JPanel optionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); optionPanel.setFont(FONT_SMALL); // all sub-components with setFont(null) inherit this font optionPanel.add(autoRedirects); optionPanel.add(followRedirects); optionPanel.add(useKeepAlive); optionPanel.add(useMultipartForPost); optionPanel.add(useBrowserCompatibleMultipartMode); optionPanel.setMinimumSize(optionPanel.getPreferredSize()); panel.add(optionPanel); } return panel; }
From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGuiClassifier.java
private void init() {// called from ctor, so must not be overridable this.setLayout(new BorderLayout()); // WEB REQUEST PANEL JPanel webRequestPanel = new JPanel(); webRequestPanel.setLayout(new BorderLayout()); webRequestPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils.getResString("web_request"))); // $NON-NLS-1$ JPanel northPanel = new JPanel(); northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS)); northPanel.add(getProtocolAndMethodPanel()); northPanel.add(getPathPanel());//from w ww.j ava 2 s . c om northPanel.add(getClassifierPanel()); webRequestPanel.add(northPanel, BorderLayout.NORTH); webRequestPanel.add(getParameterPanel(), BorderLayout.CENTER); this.add(getWebServerTimeoutPanel(), BorderLayout.NORTH); this.add(webRequestPanel, BorderLayout.CENTER); this.add(getProxyServerPanel(), BorderLayout.SOUTH); }
From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGuiClassifier.java
/** * This method defines the Panel for the HTTP path, 'Follow Redirects' * 'Use KeepAlive', and 'Use multipart for HTTP POST' elements. * * @return JPanel The Panel for the path, 'Follow Redirects' and 'Use * KeepAlive' elements.//w w w . j a v a2 s . com */ protected Component getPathPanel() { path = new JTextField(15); JLabel label = new JLabel(JMeterUtils.getResString("path")); //$NON-NLS-1$ label.setLabelFor(path); if (notConfigOnly) { followRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects")); // $NON-NLS-1$ followRedirects.setSelected(true); followRedirects.addChangeListener(this); autoRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects_auto")); //$NON-NLS-1$ autoRedirects.addChangeListener(this); autoRedirects.setSelected(false);// Default changed in 2.3 and again in 2.4 useKeepAlive = new JCheckBox(JMeterUtils.getResString("use_keepalive")); // $NON-NLS-1$ useKeepAlive.setSelected(true); useMultipartForPost = new JCheckBox(JMeterUtils.getResString("use_multipart_for_http_post")); // $NON-NLS-1$ useMultipartForPost.setSelected(false); useBrowserCompatibleMultipartMode = new JCheckBox( JMeterUtils.getResString("use_multipart_mode_browser")); // $NON-NLS-1$ useBrowserCompatibleMultipartMode .setSelected(HTTPSamplerBase.BROWSER_COMPATIBLE_MULTIPART_MODE_DEFAULT); } JPanel pathPanel = new JPanel(new BorderLayout(5, 0)); pathPanel.add(label, BorderLayout.WEST); pathPanel.add(path, BorderLayout.CENTER); pathPanel.setMinimumSize(pathPanel.getPreferredSize()); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(pathPanel); if (notConfigOnly) { JPanel optionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); optionPanel.add(autoRedirects); optionPanel.add(followRedirects); optionPanel.add(useKeepAlive); optionPanel.add(useMultipartForPost); optionPanel.add(useBrowserCompatibleMultipartMode); optionPanel.setMinimumSize(optionPanel.getPreferredSize()); panel.add(optionPanel); } return panel; }