List of usage examples for javax.swing SwingConstants LEFT
int LEFT
To view the source code for javax.swing SwingConstants LEFT.
Click Source Link
From source file:pcgen.core.SettingsHandler.java
private static String convertTabPlacementToString(final int placement) { switch (placement) { case SwingConstants.BOTTOM: return "BOTTOM"; //$NON-NLS-1$ case SwingConstants.LEFT: return "LEFT"; //$NON-NLS-1$ case SwingConstants.RIGHT: return "RIGHT"; //$NON-NLS-1$ case SwingConstants.TOP: default://from w ww . jav a2s . c om return "TOP"; //$NON-NLS-1$ } }
From source file:pl.otros.logview.gui.LogViewMainFrame.java
private void initMenu() { JMenuBar menuBar = getJMenuBar(); if (menuBar == null) { menuBar = new JMenuBar(); setJMenuBar(menuBar);// w ww. ja va2 s . co m } menuBar.removeAll(); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); JLabel labelOpenLog = new JLabel("Open log", Icons.FOLDER_OPEN, SwingConstants.LEFT); Font menuGroupFont = labelOpenLog.getFont().deriveFont(13f).deriveFont(Font.BOLD); labelOpenLog.setFont(menuGroupFont); fileMenu.add(labelOpenLog); JMenuItem openAutoDetectLog = new JMenuItem("Open log with autodetect type"); openAutoDetectLog.addActionListener(new ImportLogWithAutoDetectedImporterActionListener(otrosApplication)); openAutoDetectLog.setMnemonic(KeyEvent.VK_O); openAutoDetectLog.setIcon(Icons.WIZARD); fileMenu.add(openAutoDetectLog); JMenuItem tailAutoDetectLog = new JMenuItem("Tail log with autodetect type"); tailAutoDetectLog.addActionListener(new TailLogWithAutoDetectActionListener(otrosApplication)); tailAutoDetectLog.setMnemonic(KeyEvent.VK_T); tailAutoDetectLog.setIcon(Icons.ARROW_REPEAT); fileMenu.add(tailAutoDetectLog); fileMenu.add(new TailMultipleFilesIntoOneView(otrosApplication)); fileMenu.add(new ConnectToSocketHubAppenderAction(otrosApplication)); fileMenu.add(new JSeparator()); JLabel labelLogInvestigation = new JLabel("Log investigation", SwingConstants.LEFT); labelLogInvestigation.setFont(menuGroupFont); fileMenu.add(labelLogInvestigation); fileMenu.add(new OpenLogInvestigationAction(otrosApplication)); JMenuItem saveLogsInvest = new JMenuItem(new SaveLogInvestigationAction(otrosApplication)); enableDisableComponetsForTabs.addComponet(saveLogsInvest); fileMenu.add(saveLogsInvest); fileMenu.add(new JSeparator()); LogImporter[] importers = new LogImporter[0]; importers = logImportersContainer.getElements().toArray(importers); for (LogImporter logImporter : importers) { JMenuItem openLog = new JMenuItem("Open " + logImporter.getName() + " log"); openLog.addActionListener(new ImportLogWithGivenImporterActionListener(otrosApplication, logImporter)); if (logImporter.getKeyStrokeAccelelator() != null) { openLog.setAccelerator(KeyStroke.getKeyStroke(logImporter.getKeyStrokeAccelelator())); } if (logImporter.getMnemonic() > 0) { openLog.setMnemonic(logImporter.getMnemonic()); } Icon icon = logImporter.getIcon(); if (icon != null) { openLog.setIcon(icon); } fileMenu.add(openLog); } fileMenu.add(new JSeparator()); JLabel labelTailLog = new JLabel("Tail log [from begging of file]", Icons.ARROW_REPEAT, SwingConstants.LEFT); labelTailLog.setFont(menuGroupFont); fileMenu.add(labelTailLog); for (LogImporter logImporter : importers) { JMenuItem openLog = new JMenuItem("Tail " + logImporter.getName() + " log"); openLog.addActionListener(new TailLogActionListener(otrosApplication, logImporter)); if (logImporter.getKeyStrokeAccelelator() != null) { openLog.setAccelerator(KeyStroke.getKeyStroke(logImporter.getKeyStrokeAccelelator())); } if (logImporter.getMnemonic() > 0) { openLog.setMnemonic(logImporter.getMnemonic()); } Icon icon = logImporter.getIcon(); if (icon != null) { openLog.setIcon(icon); } fileMenu.add(openLog); } JMenuItem exitMenuItem = new JMenuItem("Exit", 'e'); exitMenuItem.setIcon(Icons.TURN_OFF); exitMenuItem.setAccelerator(KeyStroke.getKeyStroke("control F4")); exitAction = new ExitAction(this); exitMenuItem.addActionListener(exitAction); fileMenu.add(new JSeparator()); fileMenu.add(exitMenuItem); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic(KeyEvent.VK_T); JMenuItem closeAll = new JMenuItem(new CloseAllTabsAction(otrosApplication)); enableDisableComponetsForTabs.addComponet(closeAll); ArrayList<SocketLogReader> logReaders = new ArrayList<SocketLogReader>(); toolsMenu.add(new JMenuItem(new StartSocketListener(otrosApplication, logReaders))); toolsMenu.add(new JMenuItem(new StopAllSocketListeners(otrosApplication, logReaders))); toolsMenu.add(new ShowMarkersEditor(otrosApplication)); toolsMenu.add(new ShowLog4jPatternParserEditor(otrosApplication)); toolsMenu.add(new ShowMessageColorizerEditor(otrosApplication)); toolsMenu.add(new ShowLoadedPlugins(otrosApplication)); toolsMenu.add(new ShowOlvLogs(otrosApplication)); toolsMenu.add(new OpenPreferencesAction(otrosApplication)); toolsMenu.add(closeAll); JMenu pluginsMenu = new JMenu("Plugins"); otrosApplication.setPluginsMenu(pluginsMenu); JMenu helpMenu = new JMenu("Help"); JMenuItem about = new JMenuItem("About"); AboutAction action = new AboutAction(otrosApplication); action.putValue(Action.NAME, "About"); about.setAction(action); helpMenu.add(about); helpMenu.add(new GoToDonatePageAction(otrosApplication)); JMenuItem checkForNewVersion = new JMenuItem(new CheckForNewVersionAction(otrosApplication)); helpMenu.add(checkForNewVersion); helpMenu.add(new GettingStartedAction(otrosApplication)); menuBar.add(fileMenu); menuBar.add(toolsMenu); menuBar.add(pluginsMenu); menuBar.add(helpMenu); }
From source file:Provider.GoogleMapsStatic.TestUI.MySample.java
/** * @author Nazmul// ww w . ja v a2 s . c om */ private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license ttfSizeW = new JTextField("512"); ttfLat = new JTextField("45.5"); btnGetMap = new JButton("Get Map"); btnQuit = new JButton("Quit"); ttfSizeH = new JTextField("512"); ttfLon = new JTextField("-73.55"); ttfZoom = new JTextField("14"); ttaStatus = new JTextArea(); checkboxRecvStatus = new JCheckBox(); checkboxSendStatus = new JCheckBox(); ttfProgressMsg = new JTextField(); progressBar = new JProgressBar(); imgLbl = new JLabel(); /*** * @author Dhgiang, jpmolinamatute * Created a slider, zoom in/out buttons, conbo box (drop down listbox) for city selection, * a panel to group the zoom buttons and the slider bar */ slider = new JSlider(0, 19, 14); controlPanel = new JPanel(new GridBagLayout()); // controlPanel was created by jpmolinamatute cities = new JComboBox<Object>(new String[] { "Montreal", "Toronto", // the place setting where the combo box is now used to be a text field "Vancouver", "New York City", "Caracas", "Hong Kong" }); // for license key, but it was removed to accommodate space for combo box // @author Dhgiang JPanel panel1 = new JPanel(); JPanel contentPanel = new JPanel(); JPanel btnPanel = new JPanel(); JPanel dialogPane = new JPanel(); JLabel label1 = new JLabel("Select City"); // this used to be the label for license key, it was changed to label as 'select city' JLabel label2 = new JLabel("Size Width"); JLabel label3 = new JLabel("Size Height"); JLabel label4 = new JLabel("Latitude"); JLabel label5 = new JLabel("Longitude"); JLabel label6 = new JLabel("Zoom"); JButton btnZoomIn = new JButton("-"); JButton btnZoomOut = new JButton("+"); /*** * @author jpmolinamatute * Created 8 cardinal points: N,NE,NW; S,SE,SW; E, W; */ JButton btnSE = new JButton("SE"); JButton btnS = new JButton("S"); JButton btnSW = new JButton("SW"); JButton btnE = new JButton("E"); JButton btnW = new JButton("W"); JButton btnNE = new JButton("NE"); JButton btnN = new JButton("N"); JButton btnNW = new JButton("NW"); /*** * @author JPMolinaMatute * Creaetd a spaceControl GridBagConstraints object to manage * the cardinal points, and add KeyListener so users can use the * 8 cardinal keys on the num pad; initialize dimensions * */ GridBagConstraints spaceControl = new GridBagConstraints(); spaceControl.insets = new Insets(5, 5, 5, 5); controlPanel.addKeyListener(this); controlPanel.setSize(new Dimension(512, 512)); // ---- My Combo Boxes for different city coordinates ----// // ======== this ======== setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("Google Static Maps"); setIconImage(null); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== dialogPane ======== { dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setOpaque(false); dialogPane.setLayout(new BorderLayout()); // ======== contentPanel ======== { contentPanel.setOpaque(false); contentPanel.setLayout(new TableLayout( new double[][] { { TableLayoutConstants.FILL }, { TableLayoutConstants.PREFERRED, TableLayoutConstants.FILL, TableLayoutConstants.PREFERRED } })); ((TableLayout) contentPanel.getLayout()).setHGap(5); ((TableLayout) contentPanel.getLayout()).setVGap(5); // ======== panel1 ======== { panel1.setOpaque(false); panel1.setBorder(new CompoundBorder( new TitledBorder("Configure the inputs to Google Static Maps"), Borders.DLU2_BORDER)); panel1.setLayout(new TableLayout( new double[][] { { 0.17, 0.17, 0.17, 0.17, 0.05, TableLayoutConstants.FILL }, { TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED } })); ((TableLayout) panel1.getLayout()).setHGap(5); ((TableLayout) panel1.getLayout()).setVGap(5); label1.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label1, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label2 ---- label2.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label2, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfSizeW ---- panel1.add(ttfSizeW, new TableLayoutConstraints(1, 0, 1, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label4 ---- label4.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label4, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfLat ---- panel1.add(ttfLat, new TableLayoutConstraints(3, 0, 3, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- btnGetMap ---- btnGetMap.setHorizontalAlignment(SwingConstants.LEFT); btnGetMap.setMnemonic('G'); btnGetMap.setActionCommand("getMap"); btnGetMap.addActionListener(this); panel1.add(btnGetMap, new TableLayoutConstraints(5, 0, 5, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label3 ---- label3.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label3, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfSizeH ---- panel1.add(ttfSizeH, new TableLayoutConstraints(1, 1, 1, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label5 ---- label5.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label5, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfLon ---- panel1.add(ttfLon, new TableLayoutConstraints(3, 1, 3, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- btnQuit ---- btnQuit.setMnemonic('Q'); btnQuit.setHorizontalAlignment(SwingConstants.LEFT); btnQuit.setHorizontalTextPosition(SwingConstants.RIGHT); btnQuit.setActionCommand("quit"); btnQuit.addActionListener(this); panel1.add(btnQuit, new TableLayoutConstraints(5, 1, 5, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); /*** * @author Dhgiang * Added an anonymous inner class for ItemLister and event handling for the combo box * Used the switch case condition handling to set coordinates based on the city selected * Juan helped modified this method by adding the startTaskAction() at the end so * users don't have to click on Get Map button. */ cities.setSelectedIndex(0); // initialize the city selection item to 0 (or the first item) cities.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { Integer z = cities.getSelectedIndex(); switch (z) { case 0: ttfLat.setText("45.5"); ttfLon.setText("-73.55"); break; case 1: ttfLat.setText("43.65"); ttfLon.setText("-79.38"); break; case 2: ttfLat.setText("49.2505"); ttfLon.setText("-123.1119"); break; case 3: ttfLat.setText("40.7142"); ttfLon.setText("-74.0064"); break; case 4: ttfLat.setText("10.4901"); ttfLon.setText("-66.9151"); break; case 5: ttfLat.setText("22.257"); ttfLon.setText("114.2"); break; default: break; } startTaskAction(); } }); /*** * @author Dhgiang * Added the combo box to the panel */ panel1.add(cities, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); // ---- label6 ---- label6.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label6, new TableLayoutConstraints(2, 2, 2, 2, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfZoom ---- panel1.add(ttfZoom, new TableLayoutConstraints(3, 2, 3, 2, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); } { btnPanel.setOpaque(false); btnPanel.setLayout(new GridLayout(0, 3)); /**** * @author Dhgiang * Initializing the zoom IN / OUT buttons with proper parameters and * adding them to the btnPanel of Panel1 (panel within a panel) */ // ---- btnZoomIn ---- btnZoomIn.setHorizontalAlignment(SwingConstants.LEFT); btnZoomIn.setHorizontalTextPosition(SwingConstants.RIGHT); btnZoomIn.setActionCommand("Zoomin"); btnZoomIn.addActionListener(this); btnPanel.add(btnZoomIn, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); // ---- btnZoomOut ---- btnZoomOut.setHorizontalAlignment(SwingConstants.RIGHT); btnZoomOut.setHorizontalTextPosition(SwingConstants.RIGHT); btnZoomOut.setActionCommand("Zoomout"); btnZoomOut.addActionListener(this); btnPanel.add(btnZoomOut, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); /*** * @author Dhgiang * Having created a new JSlider slider object, maximum & minimum values * are initialized along with incremental values * */ // ---- slider ----- slider.setMaximum(19); slider.setMinimum(0); slider.setPaintTicks(true); slider.setMajorTickSpacing(19); slider.setMinorTickSpacing(1); slider.setPaintTrack(false); slider.createStandardLabels(4, 0); /*** * @author Dhgiang * Added a ChangeListener to the slider so that * 1) the slider moves left if (-) button is clicked, slider moves right if (+) is clicked * 2) and zoom values will increase or decrease if slider bar is shifted left or right accordingly * 3) after the user releases the click button, the map will display automatically with the values * set by the slider bar, without having the user to click on get map button */ slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { Integer a = slider.getValue(); if (a >= 0 && a <= 19) { ttfZoom.setText(a.toString()); startTaskAction(); } } }); slider.setBorder(null); /*** * @author Dhgiang * Added the slider bar to the button panel */ btnPanel.add(slider, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } /*** * @author Dhgiang * Adding the button panel to panel1 */ panel1.add(btnPanel, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); contentPanel.add(panel1, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); /*** * @author jpmolinamatute * Initializing coordinates for the cardinal points * Adding the cardinal points button to the control panel */ // ---- Cardinals points ----- btnNW.setActionCommand("Northwest"); btnNW.addActionListener(this); spaceControl.gridx = 0; spaceControl.gridy = 0; controlPanel.add(btnNW, spaceControl); btnN.setActionCommand("North"); btnN.addActionListener(this); spaceControl.gridx = 3; spaceControl.gridy = 0; controlPanel.add(btnN, spaceControl); btnNE.setActionCommand("Northeast"); btnNE.addActionListener(this); spaceControl.gridx = 6; spaceControl.gridy = 0; controlPanel.add(btnNE, spaceControl); btnW.setActionCommand("West"); btnW.addActionListener(this); spaceControl.gridx = 0; spaceControl.gridy = 3; controlPanel.add(btnW, spaceControl); spaceControl.gridx = 3; spaceControl.gridy = 3; controlPanel.add(imgLbl, spaceControl); btnE.setActionCommand("East"); btnE.addActionListener(this); spaceControl.gridx = 6; spaceControl.gridy = 3; controlPanel.add(btnE, spaceControl); btnSW.setActionCommand("Southwest"); btnSW.addActionListener(this); spaceControl.gridx = 0; spaceControl.gridy = 6; controlPanel.add(btnSW, spaceControl); btnS.setActionCommand("South"); btnS.addActionListener(this); spaceControl.gridx = 3; spaceControl.gridy = 6; controlPanel.add(btnS, spaceControl); btnSE.setActionCommand("Southeast"); btnSE.addActionListener(this); spaceControl.gridx = 6; spaceControl.gridy = 6; controlPanel.add(btnSE, spaceControl); contentPanel.add(controlPanel, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); } dialogPane.add(contentPanel, BorderLayout.CENTER); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(700, 800); setLocationRelativeTo(null); }
From source file:Provider.GoogleMapsStatic.TestUI.SampleApp.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license dialogPane = new JPanel(); contentPanel = new JPanel(); panel1 = new JPanel(); label2 = new JLabel(); ttfSizeW = new JTextField(); label4 = new JLabel(); ttfLat = new JTextField(); btnGetMap = new JButton(); label3 = new JLabel(); ttfSizeH = new JTextField(); label5 = new JLabel(); ttfLon = new JTextField(); btnQuit = new JButton(); label1 = new JLabel(); ttfLicense = new JTextField(); label6 = new JLabel(); ttfZoom = new JTextField(); scrollPane1 = new JScrollPane(); ttaStatus = new JTextArea(); panel2 = new JPanel(); panel3 = new JPanel(); checkboxRecvStatus = new JCheckBox(); checkboxSendStatus = new JCheckBox(); ttfProgressMsg = new JTextField(); progressBar = new JProgressBar(); lblProgressStatus = new JLabel(); //======== this ======== setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("Google Static Maps"); setIconImage(null);// w ww .j av a2 s. c om Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== { dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setOpaque(false); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setOpaque(false); contentPanel.setLayout(new TableLayout(new double[][] { { TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED } })); ((TableLayout) contentPanel.getLayout()).setHGap(5); ((TableLayout) contentPanel.getLayout()).setVGap(5); //======== panel1 ======== { panel1.setOpaque(false); panel1.setBorder(new CompoundBorder( new TitledBorder("Configure the inputs to Google Static Maps"), Borders.DLU2_BORDER)); panel1.setLayout( new TableLayout(new double[][] { { 0.17, 0.17, 0.17, 0.17, 0.05, TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } })); ((TableLayout) panel1.getLayout()).setHGap(5); ((TableLayout) panel1.getLayout()).setVGap(5); //---- label2 ---- label2.setText("Size Width"); label2.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label2, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfSizeW ---- ttfSizeW.setText("512"); panel1.add(ttfSizeW, new TableLayoutConstraints(1, 0, 1, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label4 ---- label4.setText("Latitude"); label4.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label4, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLat ---- ttfLat.setText("38.931099"); panel1.add(ttfLat, new TableLayoutConstraints(3, 0, 3, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- btnGetMap ---- btnGetMap.setText("Get Map"); btnGetMap.setHorizontalAlignment(SwingConstants.LEFT); btnGetMap.setMnemonic('G'); btnGetMap.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startTaskAction(); } }); panel1.add(btnGetMap, new TableLayoutConstraints(5, 0, 5, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label3 ---- label3.setText("Size Height"); label3.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label3, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfSizeH ---- ttfSizeH.setText("512"); panel1.add(ttfSizeH, new TableLayoutConstraints(1, 1, 1, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label5 ---- label5.setText("Longitude"); label5.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label5, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLon ---- ttfLon.setText("-77.3489"); panel1.add(ttfLon, new TableLayoutConstraints(3, 1, 3, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- btnQuit ---- btnQuit.setText("Quit"); btnQuit.setMnemonic('Q'); btnQuit.setHorizontalAlignment(SwingConstants.LEFT); btnQuit.setHorizontalTextPosition(SwingConstants.RIGHT); btnQuit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { quitProgram(); } }); panel1.add(btnQuit, new TableLayoutConstraints(5, 1, 5, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label1 ---- label1.setText("License Key"); label1.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label1, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLicense ---- ttfLicense.setToolTipText("Enter your own URI for a file to download in the background"); panel1.add(ttfLicense, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label6 ---- label6.setText("Zoom"); label6.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label6, new TableLayoutConstraints(2, 2, 2, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfZoom ---- ttfZoom.setText("14"); panel1.add(ttfZoom, new TableLayoutConstraints(3, 2, 3, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } contentPanel.add(panel1, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //======== scrollPane1 ======== { scrollPane1.setBorder( new TitledBorder("System.out - displays all status and progress messages, etc.")); scrollPane1.setOpaque(false); //---- ttaStatus ---- ttaStatus.setBorder(Borders.createEmptyBorder("1dlu, 1dlu, 1dlu, 1dlu")); ttaStatus.setToolTipText( "<html>Task progress updates (messages) are displayed here,<br>along with any other output generated by the Task.<html>"); scrollPane1.setViewportView(ttaStatus); } contentPanel.add(scrollPane1, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //======== panel2 ======== { panel2.setOpaque(false); panel2.setBorder(new CompoundBorder(new TitledBorder("Status - control progress reporting"), Borders.DLU2_BORDER)); panel2.setLayout(new TableLayout(new double[][] { { 0.45, TableLayout.FILL, 0.45 }, { TableLayout.PREFERRED, TableLayout.PREFERRED } })); ((TableLayout) panel2.getLayout()).setHGap(5); ((TableLayout) panel2.getLayout()).setVGap(5); //======== panel3 ======== { panel3.setOpaque(false); panel3.setLayout(new GridLayout(1, 2)); //---- checkboxRecvStatus ---- checkboxRecvStatus.setText("Enable \"Recieve\""); checkboxRecvStatus.setOpaque(false); checkboxRecvStatus.setToolTipText("Task will fire \"send\" status updates"); checkboxRecvStatus.setSelected(true); panel3.add(checkboxRecvStatus); //---- checkboxSendStatus ---- checkboxSendStatus.setText("Enable \"Send\""); checkboxSendStatus.setOpaque(false); checkboxSendStatus.setToolTipText("Task will fire \"recieve\" status updates"); panel3.add(checkboxSendStatus); } panel2.add(panel3, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfProgressMsg ---- ttfProgressMsg.setText("Loading map from Google Static Maps"); ttfProgressMsg.setToolTipText("Set the task progress message here"); panel2.add(ttfProgressMsg, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- progressBar ---- progressBar.setStringPainted(true); progressBar.setString("progress %"); progressBar.setToolTipText("% progress is displayed here"); panel2.add(progressBar, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- lblProgressStatus ---- lblProgressStatus.setText("task status listener"); lblProgressStatus.setHorizontalTextPosition(SwingConstants.LEFT); lblProgressStatus.setHorizontalAlignment(SwingConstants.LEFT); lblProgressStatus.setToolTipText("Task status messages are displayed here when the task runs"); panel2.add(lblProgressStatus, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } contentPanel.add(panel2, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } dialogPane.add(contentPanel, BorderLayout.CENTER); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(675, 485); setLocationRelativeTo(null); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:ro.nextreports.engine.exporter.ResultExporter.java
private void buildCellHAllign(Map<String, Object> format, int hAllign) { if (SwingConstants.CENTER == hAllign) { format.put(StyleFormatConstants.HORIZONTAL_ALIGN_KEY, StyleFormatConstants.HORIZONTAL_ALIGN_CENTER); }/*from w ww.j a v a 2s . c om*/ if (SwingConstants.LEFT == hAllign) { format.put(StyleFormatConstants.HORIZONTAL_ALIGN_KEY, StyleFormatConstants.HORIZONTAL_ALIGN_LEFT); } if (SwingConstants.RIGHT == hAllign) { format.put(StyleFormatConstants.HORIZONTAL_ALIGN_KEY, StyleFormatConstants.HORIZONTAL_ALIGN_RIGHT); } }
From source file:tvbrowser.ui.settings.WebbrowserSettingsTab.java
/** * Creates the settings panel for this tab. *///from w w w. ja v a 2 s . co m public JPanel createSettingsPanel() { mSettingsPn = new JPanel(new FormLayout("5dlu, 10dlu, pref, 3dlu, pref, 3dlu, pref, fill:3dlu:grow, 3dlu", "pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref")); mSettingsPn.setBorder(Borders.DIALOG_BORDER); CellConstraints cc = new CellConstraints(); mSettingsPn.add( DefaultComponentFactory.getInstance().createSeparator(mLocalizer.msg("browser", "Web browser")), cc.xyw(1, 1, 9)); JButton testButton = new LinkButton(mLocalizer.msg("testBrowser", "Test Webbrowser"), "http://www.tvbrowser.org", SwingConstants.LEFT, false); testButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String buffer = Settings.propUserDefinedWebbrowser.getString(); String bufferParams = Settings.propUserDefinedWebbrowserParams.getString(); saveSettings(); Launch.openURL("http://www.tvbrowser.org"); Settings.propUserDefinedWebbrowser.setString(buffer); Settings.propUserDefinedWebbrowserParams.setString(bufferParams); } }); mSettingsPn.add(UiUtilities.createHelpTextArea(mLocalizer.msg("help", "Help Text")), cc.xyw(2, 3, 7)); mSettingsPn.add(testButton, cc.xyw(2, 5, 7)); mSettingsPn.add(new JLabel(mLocalizer.msg("whichBrowser", "which browser")), cc.xyw(2, 7, 7)); JRadioButton useDefault = new JRadioButton(mLocalizer.msg("defaultWebbrowser", "Default Webbrowser")); useDefault.setSelected(Settings.propUserDefinedWebbrowser.getString() == null); useDefault.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { updateInputFields(); } }); mSettingsPn.add(useDefault, cc.xyw(2, 9, 4)); mUseWebbrowser = new JRadioButton(mLocalizer.msg("userDefinedWebbrowser", "user defined webbrowser")); mUseWebbrowser.setSelected(Settings.propUserDefinedWebbrowser.getString() != null); mUseWebbrowser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { updateInputFields(); } }); ButtonGroup group = new ButtonGroup(); group.add(useDefault); group.add(mUseWebbrowser); mSettingsPn.add(mUseWebbrowser, cc.xyw(2, 11, 7)); mSettingsPn.add(new JLabel(mLocalizer.msg("browserExecutable", "Executable") + ":"), cc.xy(3, 13)); mFileTextField = new JTextField(30); mFileTextField.setText(Settings.propUserDefinedWebbrowser.getString()); mSettingsPn.add(mFileTextField, cc.xy(5, 13)); mChooseButton = new JButton(Localizer.getLocalization(Localizer.I18N_SELECT)); mChooseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (mFileChooser == null) { mFileChooser = new JFileChooser(); if (OperatingSystem.isMacOs()) { mFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); } else { mFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); } } int retVal = mFileChooser.showOpenDialog(mSettingsPn.getParent()); if (retVal == JFileChooser.APPROVE_OPTION) { File f = mFileChooser.getSelectedFile(); if (f != null) { mFileTextField.setText(f.getAbsolutePath()); } } } }); mSettingsPn.add(mChooseButton, cc.xy(7, 13)); mSettingsPn.add(new JLabel(mLocalizer.msg("browserParameter", "Parameter") + ":"), cc.xy(3, 15)); mParams = new JTextField(); mParams.setText(Settings.propUserDefinedWebbrowserParams.getString()); mSettingsPn.add(mParams, cc.xy(5, 15)); mSettingsPn.add(new JLabel(mLocalizer.msg("browserParameterHelp", "{0} will be replaced by the url.")), cc.xyw(5, 17, 4)); updateInputFields(); return mSettingsPn; }
From source file:ui.panel.UILicenseAdd.java
private JPanel createSettingPnl() { JPanel panel = p.createPanel(Layouts.gridbag); GridBagConstraints g = new GridBagConstraints(); lblCloud = l.createLabel("Cloud Storage (GB):", SwingConstants.LEFT); g.gridx = 0;/*from ww w . j av a 2 s . c om*/ g.gridy = 0; g.gridwidth = 2; g.insets = new Insets(5, 5, 5, 5); g.anchor = g.FIRST_LINE_START; panel.add(lblCloud, g); lblValidity = l.createLabel("Validity Period (Months):", SwingConstants.LEFT); g.gridx = 0; g.gridy = 1; g.gridwidth = 2; g.weighty = 1.0; g.insets = new Insets(5, 5, 5, 5); panel.add(lblValidity, g); lblConcurrentVCA = l.createLabel("Max Concurrent VCA:", SwingConstants.LEFT); g.gridx = 0; g.gridy = 2; g.gridwidth = 2; g.weighty = 1.0; g.insets = new Insets(5, 5, 5, 5); g.anchor = g.LAST_LINE_START; panel.add(lblConcurrentVCA, g); spnCloud = new JSpinner(new SpinnerNumberModel(1, 0, 1, 1)); spnCloud.setPreferredSize(new Dimension(50, 25)); g.gridx = 2; g.gridy = 0; g.gridwidth = 2; g.fill = GridBagConstraints.VERTICAL; panel.add(spnCloud, g); spnValidity = new JSpinner(new SpinnerNumberModel(24, 1, 24, 1)); spnValidity.setPreferredSize(new Dimension(50, 25)); g.gridx = 2; g.gridy = 1; g.gridwidth = 2; g.fill = GridBagConstraints.VERTICAL; panel.add(spnValidity, g); spnConcurrentVCA = new JSpinner(new SpinnerNumberModel(1, 1, 4, 1)); spnConcurrentVCA.setPreferredSize(new Dimension(50, 25)); g.gridx = 2; g.gridy = 2; g.gridwidth = 2; g.fill = GridBagConstraints.VERTICAL; panel.add(spnConcurrentVCA, g); cbPerpetual = new JCheckBox("Perpetual"); cbPerpetual.setBackground(CustomColor.NavyBlue.returnColor()); cbPerpetual.setForeground(CustomColor.Grey.returnColor()); cbPerpetual.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (cbPerpetual.isSelected()) { spnValidity.setEnabled(false); } else { spnValidity.setEnabled(true); } } }); g.gridx = 5; g.gridy = 1; g.weighty = 1.0; g.fill = GridBagConstraints.VERTICAL; panel.add(cbPerpetual, g); return panel; }
From source file:ui.panel.UILicenseAdd.java
private JPanel createPnlFeature() { JPanel panel = p.createPanel(Layouts.gridbag); GridBagConstraints g = new GridBagConstraints(); lblSelectFeature = l.createLabel("Select Features", SwingConstants.LEFT); g.gridx = 0;//from w ww.j a v a 2s . c o m g.gridy = 0; g.gridwidth = 2; g.insets = new Insets(5, 5, 5, 5); panel.add(lblSelectFeature, g); lblServiceApi = l.createLabel("Service APIs Used", SwingConstants.LEFT); g.gridx = 4; g.gridy = 0; g.gridwidth = 2; g.insets = new Insets(5, 5, 5, 5); panel.add(lblServiceApi, g); getFeaturesData(); DefaultMutableTreeNode root = new MyDataNode("Features", "Features"); for (String key : Data.featureList.keySet()) { try { DefaultMutableTreeNode element = new MyDataNode(key, Data.fieldNames.get(key)); JSONArray features = Data.featureList.get(key); ArrayList<DefaultMutableTreeNode> arrayFeatureCheckBox = new ArrayList<DefaultMutableTreeNode>(); for (int i = 0; i < features.length(); i++) { JSONObject feature = features.getJSONObject(i); DefaultMutableTreeNode featureElement = new MyDataNode((String) feature.get("name"), Data.fieldNames.get(feature.get("name"))); element.add(featureElement); arrayFeatureCheckBox.add(featureElement); } root.add(element); } catch (JSONException e) { e.printStackTrace(); } } tree = new JTree(root); tree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { TreePath path = tree.getSelectionModel().getSelectionPath(); model.removeAllElements(); String item = tree.getSelectionModel().getSelectionPath().getLastPathComponent().toString(); MyDataNode node = (MyDataNode) tree.getSelectionModel().getSelectionPath().getLastPathComponent(); String selected = node.getValue(); servicesList = new HashMap<String, String>(); try { if (selected.equalsIgnoreCase("Features")) { for (String key : Data.featureList.keySet()) { JSONArray featureArray = Data.featureList.get(key); for (int i = 0; i < featureArray.length(); i++) { JSONArray servicesArray = featureArray.getJSONObject(i).getJSONArray("services"); for (int x = 0; x < servicesArray.length(); x++) { servicesList.put(Integer.toString(servicesArray.getJSONObject(x).getInt("id")), servicesArray.getJSONObject(x).getString("name")); } } } } else if (path.getPathCount() == 2) { for (String key : Data.featureList.keySet()) { if (key.equals(selected)) { JSONArray featureArray = Data.featureList.get(key); for (int i = 0; i < featureArray.length(); i++) { JSONArray servicesArray = featureArray.getJSONObject(i) .getJSONArray("services"); for (int x = 0; x < servicesArray.length(); x++) { servicesList.put( Integer.toString(servicesArray.getJSONObject(x).getInt("id")), servicesArray.getJSONObject(x).getString("name")); } } } else { continue; } } } else { MyDataNode nodePath = (MyDataNode) path.getPathComponent(1); for (String key : Data.featureList.keySet()) { if (key.equals(nodePath.getValue())) { JSONArray featureArray = Data.featureList.get(key); for (int i = 0; i < featureArray.length(); i++) { System.out.println( featureArray.getJSONObject(i).getString("name") + ":" + selected); if (featureArray.getJSONObject(i).getString("name").equals(selected)) { JSONArray servicesArray = featureArray.getJSONObject(i) .getJSONArray("services"); System.out.println(servicesArray); for (int x = 0; x < servicesArray.length(); x++) { servicesList.put( Integer.toString(servicesArray.getJSONObject(x).getInt("id")), servicesArray.getJSONObject(x).getString("name")); } } else { continue; } } } else { continue; } } } } catch (JSONException ex) { ex.printStackTrace(); } for (String serviceKey : servicesList.keySet()) { model.addElement(servicesList.get(serviceKey)); } listServiceUsed.setModel(model); } }); checkTreeManager = new CheckTreeManager(tree); spTreeCheckBox = new JScrollPane(tree); spTreeCheckBox.setPreferredSize(new Dimension(300, 300)); g.gridx = 0; g.gridy = 1; g.gridwidth = 3; g.anchor = g.LINE_START; g.insets = new Insets(5, 5, 5, 5); panel.add(spTreeCheckBox, g); model = new DefaultListModel<>(); model.addElement(""); listServiceUsed = new JList<String>(model); spList = new JScrollPane(listServiceUsed); spList.setPreferredSize(new Dimension(300, 300)); g.gridx = 4; g.gridy = 1; g.gridwidth = 3; g.anchor = g.LINE_START; panel.add(spList, g); return panel; }
From source file:ui.panel.UILicenseDetail.java
private JPanel createPnlFeature() { JPanel panel = p.createPanel(Layouts.gridbag); GridBagConstraints g = new GridBagConstraints(); g.weightx = 0.25;/*from w ww. j a v a2 s . com*/ g.weighty = 0.25; g.fill = g.BOTH; g.anchor = g.CENTER; lblSelectFeature = l.createLabel("Features", SwingConstants.LEFT); g.gridx = 0; g.gridy = 0; g.gridwidth = 2; g.insets = new Insets(5, 5, 5, 5); panel.add(lblSelectFeature, g); tree = new JTree(root); spTreeCheckBox = new JScrollPane(tree); spTreeCheckBox.setPreferredSize(new Dimension(300, 300)); g.gridx = 0; g.gridy = 1; g.gridwidth = 3; g.insets = new Insets(5, 5, 5, 5); panel.add(spTreeCheckBox, g); return panel; }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.queryresultspanel.QueryResultsPanel.java
/** * Inits the components./*ww w . j a va2 s .c om*/ */ public synchronized void initComponents() { while (activeFrame != null) { if (applicationService != null && applicationService.getFrameView() != null) { activeFrame = applicationService.getFrameView().getActiveFrame(); } } resultCountLabel = new JXLabel(QUERY_COUNT_PREFIX + resultSetCount + QUERY_COUNT_SUFFIX); resultCountLabel.setHorizontalTextPosition(SwingConstants.LEFT); queryTimeLabel = new JXLabel(QUERY_TIME_PREFIX + 0 + QUERY_TIME_SUFFIX); queryTimeLabel.setHorizontalTextPosition(SwingConstants.LEFT); displayDistinctResultsCheckBox = new JCheckBox( new AbstractAction("" + "Display only unique patient count") { public void actionPerformed(ActionEvent e) { renderQueryCountLabels(); } }); displayDistinctResultsCheckBox.setHorizontalAlignment(SwingConstants.LEFT); // create panels and add labels JPanel countPanel = new JPanel(); countPanel.setLayout(new BoxLayout(countPanel, BoxLayout.LINE_AXIS)); countPanel.add(resultCountLabel); countPanel.add(Box.createHorizontalGlue()); JPanel timePanel = new JPanel(); timePanel.setLayout(new BoxLayout(timePanel, BoxLayout.LINE_AXIS)); timePanel.add(Box.createHorizontalGlue()); timePanel.add(queryTimeLabel); timePanel.add(Box.createHorizontalGlue()); timePanel.add(displayDistinctResultsCheckBox); JPanel labelsPanel = new JPanel(); labelsPanel.setBorder(BorderFactory.createEmptyBorder(borderSize, borderSize, borderSize, borderSize)); labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.PAGE_AXIS)); labelsPanel.add(countPanel); labelsPanel.add(timePanel); resultSetTableModel = new ResultSetTableModel(); resultsTable = new JXTable(resultSetTableModel); // set cell renderer for columns in table setCellRenderer(); resultsTable.setColumnControlVisible(true); resultsTable.setHighlighters(HighlighterFactory.createAlternateStriping()); resultsTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { // get row at click point int row = resultsTable.rowAtPoint(e.getPoint()); if (row > -1) { // check if double click if (e.getClickCount() == 2) { // get id at row String patientId = resultSetTableModel.getValueAt(row, 0).toString(); logger.debug("Value of patientId : " + patientId); // set as active constraint patientPanel.setPatient(patientId); patientDialog.setTitle("Patient - " + patientId); patientDialog.setVisible(true); } } } }); JPanel lowerPanel = new JPanel(new BorderLayout()); lowerPanel.setBorder(BorderFactory.createTitledBorder("Query Results")); lowerPanel.add(labelsPanel, BorderLayout.NORTH); lowerPanel.add(new JScrollPane(resultsTable), BorderLayout.CENTER); // set components for view setLayout(new BorderLayout()); add(lowerPanel, BorderLayout.CENTER); // create patient panel createPatientDialog(); }