List of usage examples for javax.swing.border TitledBorder TitledBorder
@ConstructorProperties({ "border", "title", "titleJustification", "titlePosition", "titleFont", "titleColor" }) public TitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont, Color titleColor)
From source file:ChangingTitleBorderDirection.java
public static void main(String args[]) { JFrame frame = new JFrame("Sample Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border lineBorder = new LineBorder(Color.RED, 5); Font font = new Font("Serif", Font.ITALIC, 12); Border titledBorder = new TitledBorder(lineBorder, "Hello", TitledBorder.LEFT, TitledBorder.BELOW_BOTTOM, font, Color.RED);/* ww w . j a va2 s .c o m*/ JLabel aLabel = new JLabel("Bevel"); aLabel.setBorder(titledBorder); aLabel.setHorizontalAlignment(JLabel.CENTER); frame.add(aLabel); frame.setSize(400, 200); frame.setVisible(true); }
From source file:BorderSample.java
public static void main(String args[]) { JFrame frame = new JFrame("Sample Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border bevelBorder = new BevelBorder(BevelBorder.RAISED, Color.red, Color.red.darker(), Color.pink, Color.pink.brighter()); Border emptyBorder = new EmptyBorder(5, 10, 5, 10); Border etchedBorder = new EtchedBorder(EtchedBorder.RAISED, Color.red, Color.pink); Border lineBorder = new LineBorder(Color.red, 5); Icon diamondIcon = new DiamondIcon(Color.red); Border matteBorder = new MatteBorder(5, 10, 5, 10, diamondIcon); Border softBevelBorder = new SoftBevelBorder(BevelBorder.RAISED, Color.red, Color.red.darker(), Color.pink, Color.pink.brighter()); Font font = new Font("Serif", Font.ITALIC, 12); Border titledBorder = new TitledBorder(lineBorder, "Hello", TitledBorder.LEFT, TitledBorder.BELOW_BOTTOM, font, Color.red);/*from ww w . j av a 2 s . c om*/ Border compoundBorder = new CompoundBorder(lineBorder, matteBorder); JLabel bevelLabel = new JLabel("Bevel"); bevelLabel.setBorder(bevelBorder); bevelLabel.setHorizontalAlignment(JLabel.CENTER); JLabel emptyLabel = new JLabel("Empty"); emptyLabel.setBorder(emptyBorder); emptyLabel.setHorizontalAlignment(JLabel.CENTER); JLabel etchedLabel = new JLabel("Etched"); etchedLabel.setBorder(etchedBorder); etchedLabel.setHorizontalAlignment(JLabel.CENTER); JLabel lineLabel = new JLabel("Line"); lineLabel.setBorder(lineBorder); lineLabel.setHorizontalAlignment(JLabel.CENTER); JLabel matteLabel = new JLabel("Matte"); matteLabel.setBorder(matteBorder); matteLabel.setHorizontalAlignment(JLabel.CENTER); JLabel softBevelLabel = new JLabel("Soft Bevel"); softBevelLabel.setBorder(softBevelBorder); softBevelLabel.setHorizontalAlignment(JLabel.CENTER); JLabel titledLabel = new JLabel("Titled"); titledLabel.setBorder(titledBorder); titledLabel.setHorizontalAlignment(JLabel.CENTER); JLabel compoundLabel = new JLabel("Compound"); compoundLabel.setBorder(compoundBorder); compoundLabel.setHorizontalAlignment(JLabel.CENTER); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(2, 4, 5, 5)); contentPane.add(bevelLabel); contentPane.add(emptyLabel); contentPane.add(etchedLabel); contentPane.add(lineLabel); contentPane.add(matteLabel); contentPane.add(softBevelLabel); contentPane.add(titledLabel); contentPane.add(compoundLabel); frame.setSize(400, 200); frame.setVisible(true); }
From source file:com.jbombardier.console.panels.ProcessTelemetryPanel.java
/** * Create the panel./*from w w w. j a va 2 s .com*/ */ public ProcessTelemetryPanel() { setBorder(new TitledBorder(null, "Process Telemetry", TitledBorder.LEADING, TitledBorder.TOP, null, null)); setLayout(new MigLayout("ins 0", "[grow]", "[grow]")); stackedBarCPU = ChartBuilder.startStackedBar().setTitle("CPU").setYAxisLabel("Percentage cpu") .setXAxisLabel("").setYAxisLabel("").setOrientation(PlotOrientation.HORIZONTAL).setYMaximum(100) .toChart(); stackedBarMemory = ChartBuilder.startStackedBar().setTitle("Memory").setYAxisLabel("MBytes") .setXAxisLabel("").setOrientation(PlotOrientation.HORIZONTAL).toChart(); add(stackedBarCPU.getComponent(), "cell 0 0,grow"); add(stackedBarMemory.getComponent(), "cell 1 0,grow"); xyCPU = (XYTimeChartPanel) ChartBuilder.startXY().setTitle("CPU").setYAxisLabel("Percentage cpu used") .toChart(); xyMemory = (XYTimeChartPanel) ChartBuilder.startXY().setTitle("Memory").setYAxisLabel("MBytes free") .toChart(); add(xyCPU.getComponent(), "cell 0 1,grow"); add(xyMemory.getComponent(), "cell 1 1,grow"); timer = TimerUtils.every("ProcessTelemetryPanel-Updater", 500, TimeUnit.MILLISECONDS, new Runnable() { public void run() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { updateInternal2(); } }); } }); }
From source file:com.jbombardier.console.panels.MachineTelemetryPanel.java
/** * Create the panel./*from ww w . ja v a 2s .c om*/ */ public MachineTelemetryPanel() { setBorder(new TitledBorder(null, "Machine Telemetry", TitledBorder.LEADING, TitledBorder.TOP, null, null)); setLayout(new MigLayout("ins 0", "[grow,fill]0[grow,fill]0[grow,fill]0[grow,fill]", "[grow]0[grow]")); stackedBarCPU = ChartBuilder.startStackedBar().setTitle("CPU").setOrientation(PlotOrientation.HORIZONTAL) .setYAxisLabel("Percentage cpu").setYMaximum(100).setXAxisLabel("").setYAxisLabel("").toChart(); stackedBarMemory = ChartBuilder.startStackedBar().setTitle("Memory") .setOrientation(PlotOrientation.HORIZONTAL).setYAxisLabel("MBytes").toChart(); ioBarChart = ChartBuilder.startBar().setTitle("IO").setYAxisLabel("KBytes/sec") .setOrientation(PlotOrientation.HORIZONTAL).yAxisLock(1024).setVerticalXAxisLabels(true).toChart(); // add(stackedBarCPU.getComponent(), "cell 0 0,grow"); JPanel a = new JPanel(); a.add(stackedBarCPU.getComponent()); add(a, "cell 0 0,grow"); a.setLayout(new MigLayout("ins 0", "[grow,fill]", "[grow,fill]")); // add(stackedBarMemory.getComponent(), "cell 1 0,grow"); JPanel b = new JPanel(); b.add(stackedBarMemory.getComponent()); add(b, "cell 1 0,grow"); b.setLayout(new MigLayout("ins 0", "[grow,fill]", "[grow,fill]")); // add(stackedBarIO.getComponent(), "cell 2 0,grow, wrap"); JPanel c = new JPanel(); c.add(ioBarChart.getComponent()); add(c, "cell 2 0 2 1,grow"); c.setLayout(new MigLayout("ins 0", "[grow,fill]", "[grow,fill]")); xyCPU = (XYTimeChartPanel) ChartBuilder.startXY().setTitle("CPU").setYAxisLabel("Percentage cpu used") .toChart(); xyMemory = (XYTimeChartPanel) ChartBuilder.startXY().setTitle("Memory").setYAxisLabel("MBytes free") .toChart(); xyIORx = (XYTimeChartPanel) ChartBuilder.startXY().setTitle("Network IO").setYAxisLabel("KBytes/sec") .toChart(); xyIOTx = (XYTimeChartPanel) ChartBuilder.startXY().setTitle("Network IO").setYAxisLabel("KBytes/sec") .toChart(); // add(xyCPU.getComponent(), "cell 0 1,grow"); JPanel d = new JPanel(); d.add(xyCPU.getComponent()); add(d, "cell 0 1,grow"); d.setLayout(new MigLayout("ins 0", "[grow,fill]", "[grow,fill]")); // add(xyMemory.getComponent(), "cell 1 1,grow"); JPanel e = new JPanel(); e.add(xyMemory.getComponent()); add(e, "cell 1 1,grow"); e.setLayout(new MigLayout("ins 0", "[grow,fill]", "[grow,fill]")); JPanel f = new JPanel(); f.add(xyIORx.getComponent()); add(f, "cell 2 1,grow"); f.setLayout(new MigLayout("ins 0", "[grow,fill]", "[grow,fill]")); JPanel g = new JPanel(); g.add(xyIOTx.getComponent()); add(g, "cell 3 1,grow"); g.setLayout(new MigLayout("ins 0", "[grow,fill]", "[grow,fill]")); timer = TimerUtils.every("MachineTelemetryPanel-Updater", 500, TimeUnit.MILLISECONDS, new Runnable() { public void run() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { updateInternal2(); } }); } }); }
From source file:gdt.jgui.tool.JTextEncrypter.java
/** * The default constructor./*ww w. j a v a 2s . c om*/ */ public JTextEncrypter() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JPanel panel = new JPanel(); panel.setBorder( new TitledBorder(null, "Master password", TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panel); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); JCheckBox chckbxNewCheckBox = new JCheckBox("Show"); chckbxNewCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); chckbxNewCheckBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() != ItemEvent.SELECTED) { passwordField.setEchoChar('*'); } else { passwordField.setEchoChar((char) 0); } } }); panel.add(chckbxNewCheckBox); panel.setFocusTraversalPolicy( new FocusTraversalOnArray(new Component[] { chckbxNewCheckBox, passwordField })); passwordField = new JPasswordField(); passwordField.setMaximumSize(new Dimension(Integer.MAX_VALUE, passwordField.getPreferredSize().height)); panel.add(passwordField); JPanel panel_1 = new JPanel(); panel_1.setBorder(new TitledBorder(null, "Text", TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panel_1); panel_1.setLayout(new BorderLayout(0, 0)); textArea = new JTextArea(); textArea.setColumns(1); panel_1.add(textArea); }
From source file:au.org.ala.delta.ui.SearchDialog.java
/** * Create the dialog./*ww w. j a v a 2s . c o m*/ */ public SearchDialog(SearchController controller) { super(UIUtils.getParentFrame(controller.getOwningComponent())); hookInternalFrame(controller.getOwningComponent()); _controller = controller; UIUtils.centerDialog(this, controller.getOwningComponent().getParent()); setTitle(controller.getTitle()); setName(_controller.getTitle()); setBounds(100, 100, 366, 229); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); SingleFrameApplication application = (SingleFrameApplication) Application.getInstance(); ResourceMap messages = application.getContext().getResourceMap(); JLabel lblFind = new JLabel(messages.getString("searchDialog.lblFind")); lblFind.setMinimumSize(new Dimension(30, 0)); textField = new JTextField(); textField.setColumns(10); JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(null, messages.getString("searchDialog.groupDirection"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); buttonGroup = new ButtonGroup(); rdbtnForwards = new JRadioButton(messages.getString("searchDialog.directionForwards")); rdbtnForwards.setSelected(true); buttonGroup.add(rdbtnForwards); rdbtnBackwards = new JRadioButton(messages.getString("searchDialog.directionBackwards")); buttonGroup.add(rdbtnBackwards); contentPanel.setLayout(new MigLayout("", "[growprio 0,grow,left][grow][grow]", "[20px][21px,grow][grow]")); contentPanel.add(lblFind, "cell 0 0,alignx left,aligny top"); contentPanel.add(textField, "cell 1 0 2 1,growx,aligny top"); final JPanel panel_1 = new JPanel(); panel_1.setBorder(new TitledBorder(null, messages.getString("searchDialog.optionsPanelTitle"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); contentPanel.add(panel_1, "cell 0 1 2 1,grow"); panel_1.setLayout(new BoxLayout(panel_1, BoxLayout.Y_AXIS)); chckbxMatchCase = new JCheckBox(messages.getString("searchDialog.lblMatchCase")); panel_1.add(chckbxMatchCase); chckbxWrapSearch = new JCheckBox(messages.getString("searchDialog.lblWrapSearch")); panel_1.add(chckbxWrapSearch); chckbxWrapSearch.setSelected(true); contentPanel.add(panel, "cell 2 1,grow"); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(rdbtnForwards); panel.add(rdbtnBackwards); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton findButton = new JButton(messages.getString("searchDialog.btnFindNext")); findButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { findNext(); } }); buttonPane.add(findButton); getRootPane().setDefaultButton(findButton); } { JButton cancelButton = new JButton(messages.getString("searchDialog.btnCancel")); buttonPane.add(cancelButton); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); } } }
From source file:com.smart.aqimonitor.client.AqiMonitor.java
/** * Create the frame./*from w w w .ja v a 2s . co m*/ */ public AqiMonitor() { refSelf = this; setPreferredSize(new Dimension(640, 480)); setTitle("\u7A7A\u6C14\u8D28\u91CF\u76D1\u6D4B"); setIconImage(Toolkit.getDefaultToolkit() .getImage(AqiMonitor.class.getResource("/lombok/installer/eclipse/STS.png"))); setMinimumSize(new Dimension(640, 480)); setMaximumSize(new Dimension(1024, 768)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 636, 412); contentPane = new JPanel(); contentPane.setPreferredSize(new Dimension(640, 480)); contentPane.setMinimumSize(new Dimension(640, 480)); contentPane.setMaximumSize(new Dimension(1024, 768)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JPanel mainPanel = new JPanel(); contentPane.add(mainPanel, BorderLayout.CENTER); mainPanel.setLayout(new BorderLayout(0, 0)); JPanel contentPanel = new JPanel(); mainPanel.add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BorderLayout(0, 0)); JScrollPane scrollPane = new JScrollPane(); scrollPane .setViewportBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null)); contentPanel.add(scrollPane, BorderLayout.CENTER); textPane = new AqiTextPane(); textPane.addInputMethodListener(new InputMethodListener() { public void caretPositionChanged(InputMethodEvent event) { } public void inputMethodTextChanged(InputMethodEvent event) { textPane.setCaretPosition(document.getLength() + 1); } }); textPane.setEditable(false); textPane.setOpaque(false); textPane.setForeground(Color.BLACK); scrollPane.setViewportView(textPane); document = textPane.getStyledDocument(); document.addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { changedUpdate(e); } @Override public void insertUpdate(DocumentEvent e) { changedUpdate(e); } @Override public void changedUpdate(DocumentEvent e) { if (e.getDocument() == document) { textPane.setCaretPosition(document.getLength()); } } }); JPanel buttonPanel = new JPanel(); contentPane.add(buttonPanel, BorderLayout.SOUTH); buttonPanel.setLayout(new BorderLayout(0, 0)); JLabel lblTipsLabel = new JLabel( "Tips\uFF1A\u6587\u4EF6\u4FDD\u5B58\u683C\u5F0Fcsv\u53EF\u7528Excel\u6253\u5F00"); lblTipsLabel.setForeground(Color.BLUE); buttonPanel.add(lblTipsLabel, BorderLayout.WEST); JPanel panel = new JPanel(); buttonPanel.add(panel, BorderLayout.CENTER); panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); JButton btnRetrieve = new JButton("\u624B\u52A8\u83B7\u53D6\u6570\u636E"); panel.add(btnRetrieve); btnRetrieve.setVerticalAlignment(SwingConstants.BOTTOM); JButton btnNewButton = new JButton("\u5173\u4E8E"); btnNewButton.setToolTipText("\u5173\u4E8E"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JTextArea textArea = new JTextArea( "\n csv\n\n smartstudio@foxmail.com"); textArea.setColumns(35); textArea.setRows(6); textArea.setLineWrap(true);// textArea.setEditable(false);// textArea.setOpaque(false); JOptionPane.showMessageDialog(contentPane, textArea, "", JOptionPane.PLAIN_MESSAGE); } }); JButton btnSetting = new JButton("\u8BBE\u7F6E"); btnSetting.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Point parentPos = refSelf.getLocation(); AqiSettingDialog settingDialog = new AqiSettingDialog(refSelf, pm25InDetailJob.getAqiParser()); settingDialog.setModal(true); settingDialog.setLocation(parentPos.x + 100, parentPos.y + 150); settingDialog.init(); settingDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); settingDialog.setVisible(true); } }); JButton btnExportDir = new JButton("\u67E5\u770B\u6570\u636E"); btnExportDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { String[] cmd = new String[5]; String filePath = pm25InDetailJob.getAqiParser().getFilePath(); File file = new File(filePath); if (!file.exists()) { FileUtil.makeDir(file); } if (!file.isDirectory()) { JOptionPane.showMessageDialog(contentPane, "", "", JOptionPane.ERROR_MESSAGE); return; } cmd[0] = "cmd"; cmd[1] = "/c"; cmd[2] = "start"; cmd[3] = " "; cmd[4] = pm25InDetailJob.getAqiParser().getFilePath(); Runtime.getRuntime().exec(cmd); } catch (IOException ex) { ex.printStackTrace(); } } }); panel.add(btnExportDir); panel.add(btnSetting); panel.add(btnNewButton); btnRetrieve.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!isRetrieving) { isRetrieving = true; Thread firstRun = new Thread(new Runnable() { @Override public void run() { pm25InDetailJob.refresh(); isRetrieving = false; } }); firstRun.start(); } } }); init(); }
From source file:ca.uhn.hl7v2.testpanel.ui.AddMessageDialog.java
/** * Create the dialog./*w w w . ja va2 s. c om*/ */ public AddMessageDialog(Controller theController) { myController = theController; setMinimumSize(new Dimension(450, 400)); setPreferredSize(new Dimension(450, 400)); setSize(new Dimension(450, 400)); setResizable(false); setMaximumSize(new Dimension(450, 400)); setTitle("Add Message"); setBounds(100, 100, 450, 401); getContentPane().setLayout(new BorderLayout()); mycontentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(mycontentPanel, BorderLayout.CENTER); GridBagLayout gbl_contentPanel = new GridBagLayout(); gbl_contentPanel.columnWidths = new int[] { 0, 0 }; gbl_contentPanel.rowHeights = new int[] { 0, 0, 0 }; gbl_contentPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_contentPanel.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE }; mycontentPanel.setLayout(gbl_contentPanel); { JPanel panel = new JPanel(); panel.setBorder( new TitledBorder(null, "Message Type", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_panel = new GridBagConstraints(); gbc_panel.weighty = 1.0; gbc_panel.insets = new Insets(0, 0, 5, 0); gbc_panel.fill = GridBagConstraints.BOTH; gbc_panel.gridx = 0; gbc_panel.gridy = 0; mycontentPanel.add(panel, gbc_panel); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[] { 0, 0, 0 }; gbl_panel.rowHeights = new int[] { 0, 0, 0 }; gbl_panel.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE }; gbl_panel.rowWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE }; panel.setLayout(gbl_panel); { JLabel lblVersion = new JLabel("Version"); GridBagConstraints gbc_lblVersion = new GridBagConstraints(); gbc_lblVersion.insets = new Insets(0, 0, 5, 5); gbc_lblVersion.gridx = 0; gbc_lblVersion.gridy = 0; panel.add(lblVersion, gbc_lblVersion); } { JLabel lblType = new JLabel("Type"); GridBagConstraints gbc_lblType = new GridBagConstraints(); gbc_lblType.insets = new Insets(0, 0, 5, 0); gbc_lblType.gridx = 1; gbc_lblType.gridy = 0; panel.add(lblType, gbc_lblType); } { JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportBorder(null); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.weighty = 1.0; gbc_scrollPane.insets = new Insets(0, 0, 0, 5); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 0; gbc_scrollPane.gridy = 1; panel.add(scrollPane, gbc_scrollPane); { myVersionList = new JList(); myVersionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(myVersionList); } } { JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportBorder(null); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.weighty = 1.0; gbc_scrollPane.weightx = 1.0; gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 1; gbc_scrollPane.gridy = 1; panel.add(scrollPane, gbc_scrollPane); { myMessageTypeList = new JList(); myMessageTypeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(myMessageTypeList); } } } { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(null, "Options", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_panel = new GridBagConstraints(); gbc_panel.fill = GridBagConstraints.BOTH; gbc_panel.gridx = 0; gbc_panel.gridy = 1; mycontentPanel.add(panel, gbc_panel); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[] { 0, 0, 0 }; gbl_panel.rowHeights = new int[] { 0, 0 }; gbl_panel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE }; gbl_panel.rowWeights = new double[] { 0.0, Double.MIN_VALUE }; panel.setLayout(gbl_panel); { JLabel lblEncoding = new JLabel("Encoding"); GridBagConstraints gbc_lblEncoding = new GridBagConstraints(); gbc_lblEncoding.insets = new Insets(0, 0, 0, 5); gbc_lblEncoding.gridx = 0; gbc_lblEncoding.gridy = 0; panel.add(lblEncoding, gbc_lblEncoding); } { JPanel panel_1 = new JPanel(); panel_1.setBorder(null); GridBagConstraints gbc_panel_1 = new GridBagConstraints(); gbc_panel_1.anchor = GridBagConstraints.WEST; gbc_panel_1.fill = GridBagConstraints.VERTICAL; gbc_panel_1.gridx = 1; gbc_panel_1.gridy = 0; panel.add(panel_1, gbc_panel_1); { myEr7Radio = new JRadioButton("ER7"); myEr7Radio.setSelected(true); encodingButtonGroup.add(myEr7Radio); panel_1.add(myEr7Radio); } { JRadioButton myXmlRadio = new JRadioButton("XML"); encodingButtonGroup.add(myXmlRadio); panel_1.add(myXmlRadio); } } } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { String version = (String) myVersionList.getSelectedValue(); String fullType = (String) myMessageTypeList.getSelectedValue(); String structure = myTypesToStructures.get(fullType); String[] fullTypeBits = fullType.split("\\^"); String type = fullTypeBits[0]; String trigger = fullTypeBits[1]; Hl7V2EncodingTypeEnum encoding = myEr7Radio.isSelected() ? Hl7V2EncodingTypeEnum.ER_7 : Hl7V2EncodingTypeEnum.XML; myController.addMessage(version, type, trigger, structure, encoding); } finally { setVisible(false); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AddMessageDialog.this.setVisible(false); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } initLocal(); }
From source file:com.floreantpos.ui.forms.CustomerForm.java
private void createCustomerForm() { setOpaque(true);//from w ww. j a v a 2 s. c o m setLayout(new MigLayout("", "[][][grow][][grow]", "[][][][][][][][][][][][][][][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ picturePanel = new JPanel(new MigLayout()); lblPicture = new JLabel(""); //$NON-NLS-1$ lblPicture.setIconTextGap(0); lblPicture.setHorizontalAlignment(SwingConstants.CENTER); picturePanel.setBorder(new TitledBorder(null, Messages.getString("CustomerForm.10"), TitledBorder.LEADING, //$NON-NLS-1$ TitledBorder.TOP, null, null)); picturePanel.add(lblPicture, "wrap,center"); //$NON-NLS-1$ btnSelectImage = new PosSmallButton(); btnSelectImage.setText(Messages.getString("CustomerForm.44")); //$NON-NLS-1$ picturePanel.add(btnSelectImage, "split 2"); //$NON-NLS-1$ btnClearImage = new PosSmallButton(); btnClearImage.setText(Messages.getString("CustomerForm.45")); //$NON-NLS-1$ picturePanel.add(btnClearImage); add(picturePanel, "cell 0 0 0 8"); //$NON-NLS-1$ JLabel lblSalutation = new JLabel(Messages.getString("CustomerForm.0")); //$NON-NLS-1$ add(lblSalutation, "cell 1 0,right"); //$NON-NLS-1$ cbSalutation = new JComboBox(); cbSalutation.addItem(Messages.getString("CustomerForm.2")); //$NON-NLS-1$ cbSalutation.addItem(Messages.getString("CustomerForm.4")); //$NON-NLS-1$ cbSalutation.addItem(Messages.getString("CustomerForm.5")); //$NON-NLS-1$ cbSalutation.addItem(Messages.getString("CustomerForm.6")); //$NON-NLS-1$ cbSalutation.setPreferredSize(new Dimension(100, 0)); add(cbSalutation, "cell 2 0,grow"); //$NON-NLS-1$ JLabel lblFirstName = new JLabel(Messages.getString("CustomerForm.3")); //$NON-NLS-1$ add(lblFirstName, "cell 1 1,right "); //$NON-NLS-1$ tfFirstName = new FixedLengthTextField(30); add(tfFirstName, "cell 2 1,grow"); //$NON-NLS-1$ //tfFirstName.setFocusTraversalPolicy(policy) JLabel lblLastName = new JLabel(Messages.getString("CustomerForm.11")); //$NON-NLS-1$ add(lblLastName, "cell 1 2,right"); //$NON-NLS-1$ tfLastName = new FixedLengthTextField(); add(tfLastName, "cell 2 2,grow"); //$NON-NLS-1$ lblDob = new JLabel("DoB (MM-DD-YYYY)"); //$NON-NLS-1$ add(lblDob, "cell 1 3,right"); //$NON-NLS-1$ tfDoB = new FixedLengthTextField(); add(tfDoB, "cell 2 3,grow"); //$NON-NLS-1$ JLabel lblAddress = new JLabel(Messages.getString("CustomerForm.18")); //$NON-NLS-1$ add(lblAddress, "cell 1 4,right"); //$NON-NLS-1$ tfAddress = new JTextField(); add(tfAddress, "cell 2 4,grow"); //$NON-NLS-1$ JLabel lblZip = new JLabel(Messages.getString("CustomerForm.21")); //$NON-NLS-1$ add(lblZip, "cell 1 5,right"); //$NON-NLS-1$ tfZip = new FixedLengthTextField(); add(tfZip, "cell 2 5,grow"); //$NON-NLS-1$ lblSocialSecurityNumber = new JLabel(Messages.getString("CustomerForm.22")); //$NON-NLS-1$ add(lblSocialSecurityNumber, "cell 3 0,right"); //$NON-NLS-1$ tfSocialSecurityNumber = new FixedLengthTextField(); add(tfSocialSecurityNumber, "cell 4 0,grow"); //$NON-NLS-1$ JLabel lblCitytown = new JLabel(Messages.getString("CustomerForm.24")); //$NON-NLS-1$ add(lblCitytown, "cell 3 1,right"); //$NON-NLS-1$ // tfCity = new FixedLengthTextField(); add(tfCity, "cell 4 1,grow"); //$NON-NLS-1$ JLabel lblCountry = new JLabel(Messages.getString("CustomerForm.27")); //$NON-NLS-1$ add(lblCountry, "cell 3 2,right"); //$NON-NLS-1$ tfCountry = new FixedLengthTextField(); tfCountry.setText(Messages.getString("CustomerForm.29")); //$NON-NLS-1$ add(tfCountry, "cell 4 2,grow"); //$NON-NLS-1$ lblMobile = new JLabel(Messages.getString("CustomerForm.32")); //$NON-NLS-1$ add(lblMobile, "cell 3 3 ,right"); //$NON-NLS-1$ tfMobile = new IntegerTextField(10); add(tfMobile, "cell 4 3,grow"); //$NON-NLS-1$ lblHomePhone = new JLabel("Home Phone");//$NON-NLS-1$ add(lblHomePhone, "cell 3 4,right"); //$NON-NLS-1$ tfHomePhone = new FixedLengthTextField(); add(tfHomePhone, "cell 4 4,grow"); //$NON-NLS-1$ lblWorkPhone = new JLabel(Messages.getString("CustomerForm.39")); //$NON-NLS-1$ add(lblWorkPhone, "cell 3 5,right"); //$NON-NLS-1$ tfWorkPhone = new FixedLengthTextField(); add(tfWorkPhone, "cell 4 5,grow"); //$NON-NLS-1$ JLabel lblEmail = new JLabel(Messages.getString("CustomerForm.15")); //$NON-NLS-1$ add(lblEmail, "cell 3 6 ,right"); //$NON-NLS-1$ tfEmail = new FixedLengthTextField(); add(tfEmail, "cell 4 6,grow"); //$NON-NLS-1$ lblLoyaltyPoint = new JLabel(Messages.getString("CustomerForm.34")); //$NON-NLS-1$ add(lblLoyaltyPoint, "cell 3 7,right"); //$NON-NLS-1$ tfLoyaltyPoint = new IntegerTextField(); add(tfLoyaltyPoint, "cell 4 7,grow"); //$NON-NLS-1$ cbVip = new JCheckBox(Messages.getString("CustomerForm.41")); //$NON-NLS-1$ cbVip.setFocusable(false); add(cbVip, "cell 4 8,wrap"); //$NON-NLS-1$ JLabel lblLoyaltyNo = new JLabel(Messages.getString("CustomerForm.31")); //$NON-NLS-1$ add(lblLoyaltyNo, "cell 1 6,right"); //$NON-NLS-1$ tfLoyaltyNo = new FixedLengthTextField(); tfLoyaltyNo.setLength(8); add(tfLoyaltyNo, "cell 2 6,grow"); //$NON-NLS-1$ JLabel lblCreditLimit = new JLabel(Messages.getString("CustomerForm.37")); //$NON-NLS-1$ add(lblCreditLimit, "cell 1 7,right"); //$NON-NLS-1$ tfCreditLimit = new DoubleTextField(); tfCreditLimit.setText("500.00"); //$NON-NLS-1$ add(tfCreditLimit, "cell 2 7,grow"); //$NON-NLS-1$ qwertyKeyPad = new QwertyKeyPad(); if (isKeypad) { add(qwertyKeyPad, "cell 0 10 5 5,grow"); //$NON-NLS-1$ } btnSelectImage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { BufferedImage tmpImage; tmpImage = PosGuiUtil.selectImageFile(); if (tmpImage != null) { image = tmpImage; } if (image == null) { return; } ImageIcon imageIcon = new ImageIcon(image); lblPicture.setIcon(imageIcon); } catch (Exception e1) { PosLog.error(getClass(), e1); } } }); btnClearImage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setDefaultCustomerPicture(); } }); setDefaultCustomerPicture(); enableCustomerFields(false); callOrderController(); }
From source file:com.mgmtp.perfload.loadprofiles.ui.dialog.SettingsDialog.java
private void initComponents() { getContentPane().setLayout(new MigLayout("", "[grow]", "[][grow][grow][grow][]")); {/*from ww w .java2 s .c o m*/ JPanel pnlConfigurations = new JPanel(); pnlConfigurations.setBorder(new TitledBorder(null, "Saved Configurations", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlConfigurations.setName("pnlConfigurations"); getContentPane().add(pnlConfigurations, "cell 0 0, growx"); pnlConfigurations.setLayout(new MigLayout("", "[grow]", "[]")); { JLabel lblFileName = new JLabel("File Name"); lblFileName.setName("lblFileName"); pnlConfigurations.add(lblFileName, "flowx,cell 0 0"); } { cboConfigurationFile = new JComboBox() { @Override public void setSelectedItem(final Object anObject) { if (checkDirty()) { super.setSelectedItem(anObject); } } }; cboConfigurationFile.addItemListener(new CboConfigurationFileItemListener()); pnlConfigurations.add(cboConfigurationFile, "cell 0 0,growx"); cboConfigurationFile.setName("cboConfigurationFile"); } { JButton btnNewConfigurationFile = new JButtonExt("New..."); btnNewConfigurationFile.addActionListener(new BtnNewConfigurationFileActionListener()); pnlConfigurations.add(btnNewConfigurationFile, "cell 0 0, sg btns"); btnNewConfigurationFile.setName("btnNewButton"); } { JButton btnCopy = new JButtonExt("Copy..."); btnCopy.addActionListener(new BtnCopyActionListener()); btnCopy.setName("btnCopy"); pnlConfigurations.add(btnCopy, "cell 0 0, sg btns"); } { JButton btnDelete = new JButtonExt("Delete..."); btnDelete.addActionListener(new BtnDeleteActionListener()); btnDelete.setName("btnDelete"); pnlConfigurations.add(btnDelete, "cell 0 0, sg btns"); } } { JPanel pnlOperations = new JPanel(); getContentPane().add(pnlOperations, "cell 0 1, grow"); pnlOperations.setBorder( new TitledBorder(null, "Operations", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlOperations.setName("pnlOperations"); pnlOperations.setLayout(new MigLayout("insets 4", "[grow][110!]", "[][]")); { JScrollPane spOperations = new JScrollPane(); spOperations.setName("spOperations"); pnlOperations.add(spOperations, "cell 0 0 1 2, height 180::, grow"); { tblOperations = new JTableExt(); tblOperations.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblOperations.setFillsViewportHeight(true); tblOperations.setName("tblOperations"); spOperations.setViewportView(tblOperations); } } { JButton btnAddOperation = new JButtonExt("Add Operation"); btnAddOperation.addActionListener(new BtnAddOperationActionListener()); btnAddOperation.setMargin(new Insets(2, 2, 2, 2)); btnAddOperation.setName("btnAddOperation"); pnlOperations.add(btnAddOperation, "cell 1 0, grow"); } { JButton btnRemoveOperation = new JButtonExt("Delete Operation"); btnRemoveOperation.addActionListener(new BtnRemoveOperationActionListener()); btnRemoveOperation.setMargin(new Insets(2, 2, 2, 2)); btnRemoveOperation.setName("btnRemoveOperation"); pnlOperations.add(btnRemoveOperation, "cell 1 1, growx, top"); } } { JPanel pnlTargets = new JPanel(); getContentPane().add(pnlTargets, "cell 0 2, grow"); pnlTargets.setBorder( new TitledBorder(null, "Targets", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlTargets.setName("pnlTargets"); pnlTargets.setLayout(new MigLayout("insets 4", "[grow][110!]", "[][]")); { JScrollPane spTargets = new JScrollPane(); spTargets.setName("spTargets"); pnlTargets.add(spTargets, "cell 0 0 1 2, height 50::, grow"); { tblTargets = new JTableExt(); tblTargets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblTargets.setFillsViewportHeight(true); tblTargets.setName("tblTargets"); spTargets.setViewportView(tblTargets); } } { JButton btnAddTarget = new JButtonExt("Add Target"); btnAddTarget.addActionListener(new BtnAddTargetActionListener()); btnAddTarget.setMargin(new Insets(2, 2, 2, 2)); btnAddTarget.setName("btnAddClientConfig"); pnlTargets.add(btnAddTarget, "cell 1 0, growx"); } { JButton btnRemoveTarget = new JButtonExt("Delete Target"); btnRemoveTarget.addActionListener(new BtnRemoveTargetActionListener()); btnRemoveTarget.setMargin(new Insets(2, 2, 2, 2)); btnRemoveTarget.setName("btnRemoveClientConfig"); pnlTargets.add(btnRemoveTarget, "cell 1 1, growx, top"); } } { JPanel pnlClients = new JPanel(); getContentPane().add(pnlClients, "cell 0 3, grow"); pnlClients.setBorder( new TitledBorder(null, "Clients", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlClients.setName("pnlClientConfigs"); pnlClients.setLayout(new MigLayout("insets 4", "[grow][110!]", "[][]")); { JScrollPane spClients = new JScrollPane(); spClients.setName("spClients"); pnlClients.add(spClients, "cell 0 0 1 2, height 50::, grow"); { tblClients = new JTableExt(); tblClients.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblClients.setFillsViewportHeight(true); tblClients.setName("tblClients"); spClients.setViewportView(tblClients); } } { JButton btnAddClient = new JButtonExt("Add Client"); btnAddClient.addActionListener(new BtnAddClientActionListener()); btnAddClient.setMargin(new Insets(2, 2, 2, 2)); btnAddClient.setName("btnAddClient"); pnlClients.add(btnAddClient, "cell 1 0, growx"); } { JButton btnRemoveClient = new JButtonExt("Delete Client"); btnRemoveClient.addActionListener(new BtnRemoveClientActionListener()); btnRemoveClient.setMargin(new Insets(2, 2, 2, 2)); btnRemoveClient.setName("btnRemoveClient"); pnlClients.add(btnRemoveClient, "cell 1 1, growx, top"); } } { JButton btnOk = new JButtonExt("OK"); getRootPane().setDefaultButton(btnOk); btnOk.addActionListener(new BtnOkActionListener()); btnOk.setName("btnOk"); getContentPane().add(btnOk, "cell 0 4,alignx right"); } { JButton btnCancel = new JButtonExt("Cancel"); btnCancel.addActionListener(new BtnCancelActionListener()); btnCancel.setName("btnCancel"); getContentPane().add(btnCancel, "cell 0 4,alignx right"); } }