List of usage examples for javax.swing SwingConstants CENTER
int CENTER
To view the source code for javax.swing SwingConstants CENTER.
Click Source Link
From source file:org.graphwalker.GUI.App.java
private void createPanelGraph() { panelGraph = new JPanel(); panelGraph.setLayout(new BorderLayout()); setLatestVertexLabel(new JLabel(" ")); getLatestVertexLabel().setHorizontalAlignment(SwingConstants.CENTER); getLatestVertexLabel().setOpaque(true); panelGraph.add(getLatestVertexLabel(), BorderLayout.NORTH); panelGraph.add(getGraphViewer(), BorderLayout.CENTER); }
From source file:org.gtdfree.GTDFree.java
/** * This method initializes aboutDialog * /*from ww w. j av a2s. c o m*/ * @return javax.swing.JDialog */ private JDialog getAboutDialog() { if (aboutDialog == null) { aboutDialog = new JDialog(getJFrame(), true); aboutDialog.setTitle(Messages.getString("GTDFree.About.Free")); //$NON-NLS-1$ Image i = ApplicationHelper.loadImage(ApplicationHelper.icon_name_large_logo); //$NON-NLS-1$ ImageIcon ii = new ImageIcon(i); JTabbedPane jtp = new JTabbedPane(); JPanel jp = new JPanel(); jp.setLayout(new GridBagLayout()); JLabel jl = new JLabel("GTD-Free", ii, SwingConstants.CENTER); //$NON-NLS-1$ jl.setIconTextGap(22); jl.setFont(jl.getFont().deriveFont((float) 24)); jp.add(jl, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 11, 11), 0, 0)); String s = "Version " + ApplicationHelper.getVersion(); //$NON-NLS-1$ jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 11, 4, 11), 0, 0)); s = Messages.getString("GTDFree.About.DBType") //$NON-NLS-1$ + getEngine().getGTDModel().getDataRepository().getDatabaseType(); jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 2, 11), 0, 0)); s = Messages.getString("GTDFree.About.DBloc") + getEngine().getDataFolder(); //$NON-NLS-1$ jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 3, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 11, 4, 11), 0, 0)); jp.add(new JLabel("Copyright 2008,2009 ikesan@users.sourceforge.net", SwingConstants.CENTER), //$NON-NLS-1$ new GridBagConstraints(0, 4, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab("About", jp); //$NON-NLS-1$ jp = new JPanel(); jp.setLayout(new GridBagLayout()); TableModel tm = new AbstractTableModel() { private static final long serialVersionUID = -8449423008172417278L; private String[] props; private String[] getProperties() { if (props == null) { props = System.getProperties().keySet().toArray(new String[System.getProperties().size()]); Arrays.sort(props); } return props; } @Override public String getColumnName(int column) { switch (column) { case 0: return Messages.getString("GTDFree.About.Prop"); //$NON-NLS-1$ case 1: return Messages.getString("GTDFree.About.Val"); //$NON-NLS-1$ default: return null; } } public int getColumnCount() { return 2; } public int getRowCount() { return getProperties().length; } public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return getProperties()[rowIndex]; case 1: return System.getProperty(getProperties()[rowIndex]); default: return null; } } }; JTable jt = new JTable(tm); jp.add(new JScrollPane(jt), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab(Messages.getString("GTDFree.About.SysP"), jp); //$NON-NLS-1$ jp = new JPanel(); jp.setLayout(new GridBagLayout()); JTextArea ta = new JTextArea(); ta.setEditable(false); ta.setText(ApplicationHelper.loadLicense()); ta.setCaretPosition(0); jp.add(new JScrollPane(ta), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab("License", jp); //$NON-NLS-1$ aboutDialog.setContentPane(jtp); aboutDialog.setSize(550, 300); //aboutDialog.pack(); aboutDialog.setLocationRelativeTo(getJFrame()); } return aboutDialog; }
From source file:org.interreg.docexplore.DocExploreTool.java
@SuppressWarnings("serial") protected static File askForHome(String text) { final File[] file = { null }; final JDialog dialog = new JDialog((Frame) null, XMLResourceBundle.getBundledString("homeLabel"), true); JPanel content = new JPanel(new LooseGridLayout(0, 1, 10, 10, true, false, SwingConstants.CENTER, SwingConstants.TOP, true, false)); content.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); JLabel message = new JLabel(text, ImageUtils.getIcon("free-64x64.png"), SwingConstants.LEFT); message.setIconTextGap(20);/* www . j a va2s .c om*/ //message.setFont(Font.decode(Font.SANS_SERIF)); content.add(message); final JPanel pathPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); pathPanel.add(new JLabel("<html><b>" + XMLResourceBundle.getBundledString("homeLabel") + ":</b></html>")); final JTextField pathField = new JTextField(System.getProperty("user.home") + File.separator + "DocExplore", 40); pathPanel.add(pathField); pathPanel.add(new JButton(new AbstractAction(XMLResourceBundle.getBundledString("browseLabel")) { JNativeFileDialog nfd = null; public void actionPerformed(ActionEvent arg0) { if (nfd == null) { nfd = new JNativeFileDialog(); nfd.acceptFiles = false; nfd.acceptFolders = true; nfd.multipleSelection = false; nfd.title = XMLResourceBundle.getBundledString("homeLabel"); } nfd.setCurrentFile(new File(pathField.getText())); if (nfd.showOpenDialog()) pathField.setText(nfd.getSelectedFile().getAbsolutePath()); } })); content.add(pathPanel); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); buttonPanel.add(new JButton(new AbstractAction(XMLResourceBundle.getBundledString("cfgOkLabel")) { public void actionPerformed(ActionEvent e) { File res = new File(pathField.getText()); if (res.exists() && !res.isDirectory() || !res.exists() && !res.mkdirs()) JOptionPane.showMessageDialog(dialog, XMLResourceBundle.getBundledString("homeErrorMessage"), XMLResourceBundle.getBundledString("errorLabel"), JOptionPane.ERROR_MESSAGE); else { file[0] = res; dialog.setVisible(false); } } })); buttonPanel.add(new JButton(new AbstractAction(XMLResourceBundle.getBundledString("cfgCancelLabel")) { public void actionPerformed(ActionEvent e) { dialog.setVisible(false); } })); content.add(buttonPanel); dialog.getContentPane().add(content); dialog.pack(); dialog.setResizable(false); GuiUtils.centerOnScreen(dialog); dialog.setVisible(true); return file[0]; }
From source file:org.isatools.isacreatorconfigurator.ontologyconfigurationtool.OntologyConfigUI.java
private void setOntologySelectionPanelPlaceholder(ImageIcon image) { JPanel placeHolder = new JPanel(new GridLayout(1, 1)); placeHolder.add(new JLabel(image, SwingConstants.CENTER)); placeHolder.setPreferredSize(new Dimension(500, 300)); ontologyViewContainer.removeAll();//from w ww. ja v a2 s . c o m ontologyViewContainer.add(placeHolder); ontologyViewContainer.revalidate(); ontologyViewContainer.repaint(); }
From source file:org.jajuk.ui.thumbnails.LastFmAlbumThumbnail.java
/** * Thumb populating done in EDT.//from w ww.j a va 2 s . c o m */ @Override public void populate() { preLoad(); if (ii == null) { return; } jlIcon = new JLabel(); postPopulate(); jlIcon.setIcon(ii); setLayout(new MigLayout("ins 0,gapy 2")); add(jlIcon, "center,wrap"); JLabel jlTitle; String fullTitle = album.getTitle(); // Add year if available String releaseDate = album.getReleaseDateString(); if (StringUtils.isNotBlank(releaseDate)) { fullTitle += " (" + releaseDate + ")"; } int textLength = 15; if (isArtistView()) { textLength = 50; } if (bKnown) { // Album known in collection, display its name in bold jlTitle = new JLabel(UtilString.getLimitedString(fullTitle, textLength), IconLoader.getIcon(JajukIcons.ALBUM), SwingConstants.CENTER); jlTitle.setFont(FontManager.getInstance().getFont(JajukFont.BOLD)); } else { jlTitle = new JLabel(UtilString.getLimitedString(fullTitle, textLength)); jlTitle.setFont(FontManager.getInstance().getFont(JajukFont.PLAIN)); } jlTitle.setToolTipText(album.getTitle()); jlIcon.setToolTipText(album.getTitle()); add(jlTitle, "center"); jlIcon.setBorder(new DropShadowBorder(Color.BLACK, 5, 0.5f, 5, false, true, false, true)); // disable inadequate menu items jmiCDDBWizard.setEnabled(false); jmiGetCovers.setEnabled(false); if (getItem() == null) { jmiDelete.setEnabled(false); jmiPlay.setEnabled(false); jmiPlayRepeat.setEnabled(false); jmiPlayShuffle.setEnabled(false); jmiFrontPush.setEnabled(false); jmiPush.setEnabled(false); jmiProperties.setEnabled(false); } // Set URL to open if (UtilSystem.isBrowserSupported()) { jmiOpenLastFMSite.putClientProperty(Const.DETAIL_CONTENT, album.getUrl()); } }
From source file:org.jcurl.mr.gui.BroomPanel0.java
public BroomPanel0(final Model m) { model = m == null ? new Model() : m; model.addPropertyChangeListener(this); setVisible(false);//from www . ja va2 s . c om setLayout(new BorderLayout()); final JLabel label; this.add(label = new JLabel(), "North"); label.setText("Broom"); label.setHorizontalAlignment(SwingConstants.CENTER); this.add(slider = new JSlider(), "Center"); slider.setOrientation(SwingConstants.VERTICAL); final int max = (int) (new Measure(IceSize.SIDE_2_CENTER, Unit.METER).to(dim).value * Granularity); slider.setMaximum((int) (Granularity * Math.ceil((double) max / Granularity))); // slider.setMaximum(2500); slider.setMinimum(-slider.getMaximum()); slider.setMajorTickSpacing(Granularity); slider.setMinorTickSpacing(Granularity / 10); slider.setAlignmentX(10); slider.setPaintLabels(true); slider.setPaintTicks(true); slider.setPaintTrack(true); slider.addChangeListener(this); this.add(text = new JTextField(), "South"); text.setHorizontalAlignment(SwingConstants.CENTER); text.setEditable(true); text.addActionListener(this); text.selectAll(); this.setSize(50, 100); model.setBroomX(new Measure(0, dim)); setVisible(true); }
From source file:org.jtrfp.trcl.gui.ConfigWindow.java
public ConfigWindow() { setTitle("Settings"); setSize(340, 540);/*from w w w. j a va2 s.c o m*/ if (config == null) config = new TRConfiguration(); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); getContentPane().add(tabbedPane, BorderLayout.CENTER); JPanel generalTab = new JPanel(); tabbedPane.addTab("General", new ImageIcon(ConfigWindow.class .getResource("/org/freedesktop/tango/22x22/mimetypes/application-x-executable.png")), generalTab, null); GridBagLayout gbl_generalTab = new GridBagLayout(); gbl_generalTab.columnWidths = new int[] { 0, 0 }; gbl_generalTab.rowHeights = new int[] { 0, 188, 222, 0 }; gbl_generalTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_generalTab.rowWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE }; generalTab.setLayout(gbl_generalTab); JPanel settingsLoadSavePanel = new JPanel(); GridBagConstraints gbc_settingsLoadSavePanel = new GridBagConstraints(); gbc_settingsLoadSavePanel.insets = new Insets(0, 0, 5, 0); gbc_settingsLoadSavePanel.anchor = GridBagConstraints.WEST; gbc_settingsLoadSavePanel.gridx = 0; gbc_settingsLoadSavePanel.gridy = 0; generalTab.add(settingsLoadSavePanel, gbc_settingsLoadSavePanel); settingsLoadSavePanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Overall Settings", TitledBorder.LEADING, TitledBorder.TOP, null, null)); FlowLayout flowLayout_1 = (FlowLayout) settingsLoadSavePanel.getLayout(); flowLayout_1.setAlignment(FlowLayout.LEFT); JButton btnSave = new JButton("Export..."); btnSave.setToolTipText("Export these settings to an external file"); settingsLoadSavePanel.add(btnSave); btnSave.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { exportSettings(); } }); JButton btnLoad = new JButton("Import..."); btnLoad.setToolTipText("Import an external settings file"); settingsLoadSavePanel.add(btnLoad); btnLoad.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { importSettings(); } }); JButton btnConfigReset = new JButton("Reset"); btnConfigReset.setToolTipText("Reset all settings to defaults"); settingsLoadSavePanel.add(btnConfigReset); btnConfigReset.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { defaultSettings(); } }); JPanel registeredPODsPanel = new JPanel(); registeredPODsPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Registered PODs", TitledBorder.LEFT, TitledBorder.TOP, null, null)); GridBagConstraints gbc_registeredPODsPanel = new GridBagConstraints(); gbc_registeredPODsPanel.insets = new Insets(0, 0, 5, 0); gbc_registeredPODsPanel.fill = GridBagConstraints.BOTH; gbc_registeredPODsPanel.gridx = 0; gbc_registeredPODsPanel.gridy = 1; generalTab.add(registeredPODsPanel, gbc_registeredPODsPanel); GridBagLayout gbl_registeredPODsPanel = new GridBagLayout(); gbl_registeredPODsPanel.columnWidths = new int[] { 272, 0 }; gbl_registeredPODsPanel.rowHeights = new int[] { 76, 0, 0 }; gbl_registeredPODsPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_registeredPODsPanel.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE }; registeredPODsPanel.setLayout(gbl_registeredPODsPanel); JPanel podListPanel = new JPanel(); GridBagConstraints gbc_podListPanel = new GridBagConstraints(); gbc_podListPanel.insets = new Insets(0, 0, 5, 0); gbc_podListPanel.fill = GridBagConstraints.BOTH; gbc_podListPanel.gridx = 0; gbc_podListPanel.gridy = 0; registeredPODsPanel.add(podListPanel, gbc_podListPanel); podListPanel.setLayout(new BorderLayout(0, 0)); JScrollPane podListScrollPane = new JScrollPane(); podListPanel.add(podListScrollPane, BorderLayout.CENTER); podList = new JList(podLM); podList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); podListScrollPane.setViewportView(podList); JPanel podListOpButtonPanel = new JPanel(); podListOpButtonPanel.setBorder(null); GridBagConstraints gbc_podListOpButtonPanel = new GridBagConstraints(); gbc_podListOpButtonPanel.anchor = GridBagConstraints.NORTH; gbc_podListOpButtonPanel.gridx = 0; gbc_podListOpButtonPanel.gridy = 1; registeredPODsPanel.add(podListOpButtonPanel, gbc_podListOpButtonPanel); FlowLayout flowLayout = (FlowLayout) podListOpButtonPanel.getLayout(); flowLayout.setAlignment(FlowLayout.LEFT); JButton addPodButton = new JButton("Add..."); addPodButton.setIcon( new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png"))); addPodButton.setToolTipText("Add a POD to the registry to be considered when running a game."); podListOpButtonPanel.add(addPodButton); addPodButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { addPOD(); } }); JButton removePodButton = new JButton("Remove"); removePodButton.setIcon(new ImageIcon( ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png"))); removePodButton.setToolTipText("Remove a POD file from being considered when playing a game"); podListOpButtonPanel.add(removePodButton); removePodButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { podLM.removeElement(podList.getSelectedValue()); } }); JButton podEditButton = new JButton("Edit..."); podEditButton.setIcon(null); podEditButton.setToolTipText("Edit the selected POD path"); podListOpButtonPanel.add(podEditButton); podEditButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { editPODPath(); } }); JPanel missionPanel = new JPanel(); GridBagConstraints gbc_missionPanel = new GridBagConstraints(); gbc_missionPanel.fill = GridBagConstraints.BOTH; gbc_missionPanel.gridx = 0; gbc_missionPanel.gridy = 2; generalTab.add(missionPanel, gbc_missionPanel); missionPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Missions", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagLayout gbl_missionPanel = new GridBagLayout(); gbl_missionPanel.columnWidths = new int[] { 0, 0 }; gbl_missionPanel.rowHeights = new int[] { 0, 0, 0 }; gbl_missionPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_missionPanel.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE }; missionPanel.setLayout(gbl_missionPanel); JScrollPane scrollPane = new JScrollPane(); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.insets = new Insets(0, 0, 5, 0); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 0; gbc_scrollPane.gridy = 0; missionPanel.add(scrollPane, gbc_scrollPane); missionList = new JList(missionLM); missionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(missionList); JPanel missionListOpButtonPanel = new JPanel(); GridBagConstraints gbc_missionListOpButtonPanel = new GridBagConstraints(); gbc_missionListOpButtonPanel.anchor = GridBagConstraints.NORTH; gbc_missionListOpButtonPanel.gridx = 0; gbc_missionListOpButtonPanel.gridy = 1; missionPanel.add(missionListOpButtonPanel, gbc_missionListOpButtonPanel); JButton addVOXButton = new JButton("Add..."); addVOXButton.setIcon( new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png"))); addVOXButton.setToolTipText("Add an external VOX file as a mission"); missionListOpButtonPanel.add(addVOXButton); addVOXButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { addVOX(); } }); final JButton removeVOXButton = new JButton("Remove"); removeVOXButton.setIcon(new ImageIcon( ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png"))); removeVOXButton.setToolTipText("Remove the selected mission"); missionListOpButtonPanel.add(removeVOXButton); removeVOXButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { missionLM.remove(missionList.getSelectedIndex()); } }); final JButton editVOXButton = new JButton("Edit..."); editVOXButton.setToolTipText("Edit the selected Mission's VOX path"); missionListOpButtonPanel.add(editVOXButton); editVOXButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { editVOXPath(); } }); missionList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { final String val = (String) missionList.getSelectedValue(); if (val == null) missionList.setSelectedIndex(0); else if (isBuiltinVOX(val)) { removeVOXButton.setEnabled(false); editVOXButton.setEnabled(false); } else { removeVOXButton.setEnabled(true); editVOXButton.setEnabled(true); } } }); JPanel soundTab = new JPanel(); tabbedPane.addTab("Sound", new ImageIcon( ConfigWindow.class.getResource("/org/freedesktop/tango/22x22/devices/audio-card.png")), soundTab, null); GridBagLayout gbl_soundTab = new GridBagLayout(); gbl_soundTab.columnWidths = new int[] { 0, 0 }; gbl_soundTab.rowHeights = new int[] { 65, 51, 70, 132, 0, 0, 0 }; gbl_soundTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_soundTab.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; soundTab.setLayout(gbl_soundTab); JPanel checkboxPanel = new JPanel(); GridBagConstraints gbc_checkboxPanel = new GridBagConstraints(); gbc_checkboxPanel.insets = new Insets(0, 0, 5, 0); gbc_checkboxPanel.fill = GridBagConstraints.BOTH; gbc_checkboxPanel.gridx = 0; gbc_checkboxPanel.gridy = 0; soundTab.add(checkboxPanel, gbc_checkboxPanel); chckbxLinearInterpolation = new JCheckBox("Linear Filtering"); chckbxLinearInterpolation.setToolTipText("Use the GPU's TMU to smooth playback of low-rate samples."); chckbxLinearInterpolation.setHorizontalAlignment(SwingConstants.LEFT); checkboxPanel.add(chckbxLinearInterpolation); chckbxLinearInterpolation.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { needRestart = true; } }); chckbxBufferLag = new JCheckBox("Buffer Lag"); chckbxBufferLag.setToolTipText("Improves efficiency, doubles latency."); checkboxPanel.add(chckbxBufferLag); JPanel modStereoWidthPanel = new JPanel(); FlowLayout flowLayout_2 = (FlowLayout) modStereoWidthPanel.getLayout(); flowLayout_2.setAlignment(FlowLayout.LEFT); modStereoWidthPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "MOD Stereo Width", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_modStereoWidthPanel = new GridBagConstraints(); gbc_modStereoWidthPanel.anchor = GridBagConstraints.NORTH; gbc_modStereoWidthPanel.insets = new Insets(0, 0, 5, 0); gbc_modStereoWidthPanel.fill = GridBagConstraints.HORIZONTAL; gbc_modStereoWidthPanel.gridx = 0; gbc_modStereoWidthPanel.gridy = 1; soundTab.add(modStereoWidthPanel, gbc_modStereoWidthPanel); modStereoWidthSlider = new JSlider(); modStereoWidthSlider.setPaintTicks(true); modStereoWidthSlider.setMinorTickSpacing(25); modStereoWidthPanel.add(modStereoWidthSlider); final JLabel modStereoWidthLbl = new JLabel("NN%"); modStereoWidthPanel.add(modStereoWidthLbl); JPanel bufferSizePanel = new JPanel(); FlowLayout flowLayout_3 = (FlowLayout) bufferSizePanel.getLayout(); flowLayout_3.setAlignment(FlowLayout.LEFT); bufferSizePanel.setBorder( new TitledBorder(null, "Buffer Size", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_bufferSizePanel = new GridBagConstraints(); gbc_bufferSizePanel.anchor = GridBagConstraints.NORTH; gbc_bufferSizePanel.insets = new Insets(0, 0, 5, 0); gbc_bufferSizePanel.fill = GridBagConstraints.HORIZONTAL; gbc_bufferSizePanel.gridx = 0; gbc_bufferSizePanel.gridy = 2; soundTab.add(bufferSizePanel, gbc_bufferSizePanel); audioBufferSizeCB = new JComboBox(); audioBufferSizeCB.setModel(new DefaultComboBoxModel(AudioBufferSize.values())); bufferSizePanel.add(audioBufferSizeCB); soundOutputSelectorGUI = new SoundOutputSelectorGUI(); soundOutputSelectorGUI.setBorder( new TitledBorder(null, "Output Driver", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_soundOutputSelectorGUI = new GridBagConstraints(); gbc_soundOutputSelectorGUI.anchor = GridBagConstraints.NORTH; gbc_soundOutputSelectorGUI.insets = new Insets(0, 0, 5, 0); gbc_soundOutputSelectorGUI.fill = GridBagConstraints.HORIZONTAL; gbc_soundOutputSelectorGUI.gridx = 0; gbc_soundOutputSelectorGUI.gridy = 3; soundTab.add(soundOutputSelectorGUI, gbc_soundOutputSelectorGUI); modStereoWidthSlider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { modStereoWidthLbl.setText(modStereoWidthSlider.getValue() + "%"); needRestart = true; } }); JPanel okCancelPanel = new JPanel(); getContentPane().add(okCancelPanel, BorderLayout.SOUTH); okCancelPanel.setLayout(new BorderLayout(0, 0)); JButton btnOk = new JButton("OK"); btnOk.setToolTipText("Apply these settings and close the window"); okCancelPanel.add(btnOk, BorderLayout.WEST); btnOk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { applySettings(); ConfigWindow.this.setVisible(false); } }); JButton btnCancel = new JButton("Cancel"); btnCancel.setToolTipText("Close the window without applying settings"); okCancelPanel.add(btnCancel, BorderLayout.EAST); JLabel lblConfigpath = new JLabel(TRConfiguration.getConfigFilePath().getAbsolutePath()); lblConfigpath.setIcon(null); lblConfigpath.setToolTipText("Default config file path"); lblConfigpath.setHorizontalAlignment(SwingConstants.CENTER); lblConfigpath.setFont(new Font("Dialog", Font.BOLD, 6)); okCancelPanel.add(lblConfigpath, BorderLayout.CENTER); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { ConfigWindow.this.setVisible(false); } }); }
From source file:org.nuclos.client.ui.JInfoTabbedPane.java
private void setTabComponent(String text, int index) { JLabel tabComponent = new JLabel(text); int height = tabComponent.getFontMetrics(tabComponent.getFont()).getHeight(); int width = tabComponent.getFontMetrics(tabComponent.getFont()).stringWidth(text + " (>999)"); tabComponent.setPreferredSize(new Dimension(width, height)); tabComponent.setHorizontalAlignment(SwingConstants.CENTER); setTabComponentAt(index, tabComponent); }
From source file:org.nuxeo.launcher.gui.NuxeoFrame.java
protected JComponent buildFooter() { JLabel label = new JLabel(NuxeoLauncherGUI.getMessage("footer.label", new DateTime().toString("Y"))); label.setForeground(Color.WHITE); label.setPreferredSize(new Dimension(470, 16)); label.setFont(new Font(label.getFont().getName(), label.getFont().getStyle(), 9)); label.setHorizontalAlignment(SwingConstants.CENTER); return label; }
From source file:org.nyu.edu.dlts.dbCopyFrame.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(); apiLabel = new JLabel(); panel4 = new JPanel(); label9 = new JLabel(); beanShellRadioButton = new JRadioButton(); jrubyRadioButton = new JRadioButton(); pythonRadioButton = new JRadioButton(); javascriptRadioButton = new JRadioButton(); loadExcelFileButton = new JButton(); excelTextField = new JTextField(); loadMapperScriptButton = new JButton(); mapperScriptTextField = new JTextField(); editScriptButton = new JButton(); separator2 = new JSeparator(); panel5 = new JPanel(); createRepositoryCheckBox = new JCheckBox(); repoShortNameTextField = new JTextField(); repoNameTextField = new JTextField(); repoCodeTextField = new JTextField(); repoURLTextField = new JTextField(); panel2 = new JPanel(); label1 = new JLabel(); label3 = new JLabel(); label10 = new JLabel(); locationsTextField = new JTextField(); locationsLabel = new JLabel(); label5 = new JLabel(); subjectsTextField = new JTextField(); subjectsLabel = new JLabel(); label4 = new JLabel(); namesTextField = new JTextField(); namesLabel = new JLabel(); label6 = new JLabel(); accessionsTextField = new JTextField(); accessionsLabel = new JLabel(); label7 = new JLabel(); digitalObjectsTextField = new JTextField(); digitalObjectLabel = new JLabel(); label8 = new JLabel(); resourcesTextField = new JTextField(); resourcesLabel = new JLabel(); separator1 = new JSeparator(); copyToASpaceButton = new JButton(); hostLabel = new JLabel(); hostTextField = new JTextField(); simulateCheckBox = new JCheckBox(); adminLabel = new JLabel(); adminTextField = new JTextField(); adminPasswordLabel = new JLabel(); adminPasswordTextField = new JTextField(); label2 = new JLabel(); repositoryURITextField = new JTextField(); developerModeCheckBox = new JCheckBox(); outputConsoleLabel = new JLabel(); copyProgressBar = new JProgressBar(); scrollPane1 = new JScrollPane(); consoleTextArea = new JTextArea(); recordURIComboBox = new JComboBox(); panel1 = new JPanel(); paramsLabel = new JLabel(); paramsTextField = new JTextField(); viewRecordButton = new JButton(); buttonBar = new JPanel(); errorLogButton = new JButton(); saveErrorsLabel = new JLabel(); errorCountLabel = new JLabel(); stopButton = new JButton(); utillitiesButton = new JButton(); okButton = new JButton(); CellConstraints cc = new CellConstraints(); //======== this ======== setTitle("Archives Space Excel Data Migrator"); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== {/*w ww . jav a 2 s. c om*/ dialogPane.setBorder(Borders.DIALOG_BORDER); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.TOP, Sizes.DEFAULT, FormSpec.NO_GROW), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- apiLabel ---- apiLabel.setText(" Archives Space Version: v1.1.0"); apiLabel.setHorizontalTextPosition(SwingConstants.CENTER); apiLabel.setFont(new Font("Lucida Grande", Font.BOLD, 14)); contentPanel.add(apiLabel, cc.xy(1, 1)); //======== panel4 ======== { panel4.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, RowSpec.decodeSpecs("default"))); //---- label9 ---- label9.setText("Select Script Type"); panel4.add(label9, cc.xy(1, 1)); //---- beanShellRadioButton ---- beanShellRadioButton.setText("Beanshell"); beanShellRadioButton.setSelected(true); beanShellRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clearMapperScript(); } }); panel4.add(beanShellRadioButton, cc.xy(3, 1)); //---- jrubyRadioButton ---- jrubyRadioButton.setText("JRuby"); jrubyRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clearMapperScript(); } }); panel4.add(jrubyRadioButton, cc.xy(5, 1)); //---- pythonRadioButton ---- pythonRadioButton.setText("Jython"); pythonRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clearMapperScript(); } }); panel4.add(pythonRadioButton, cc.xy(7, 1)); //---- javascriptRadioButton ---- javascriptRadioButton.setText("Javascript"); javascriptRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clearMapperScript(); } }); panel4.add(javascriptRadioButton, cc.xy(9, 1)); } contentPanel.add(panel4, cc.xywh(3, 1, 7, 1)); //---- loadExcelFileButton ---- loadExcelFileButton.setText("Load Excel File"); loadExcelFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { loadExcelFileButtonActionPerformed(); } }); contentPanel.add(loadExcelFileButton, cc.xy(1, 3)); contentPanel.add(excelTextField, cc.xywh(3, 3, 5, 1)); //---- loadMapperScriptButton ---- loadMapperScriptButton.setText("Load Mapper Script"); loadMapperScriptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { loadMapperScriptButtonActionPerformed(); } }); contentPanel.add(loadMapperScriptButton, cc.xy(1, 5)); //---- mapperScriptTextField ---- mapperScriptTextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { loadMapperScript(); } }); contentPanel.add(mapperScriptTextField, cc.xywh(3, 5, 5, 1)); //---- editScriptButton ---- editScriptButton.setText("Edit"); editScriptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { editScriptButtonActionPerformed(); } }); contentPanel.add(editScriptButton, cc.xy(9, 5)); contentPanel.add(separator2, cc.xywh(1, 7, 9, 1)); //======== panel5 ======== { panel5.setLayout(new FormLayout(ColumnSpec.decodeSpecs("default:grow"), new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- createRepositoryCheckBox ---- createRepositoryCheckBox.setText("Create Repository"); createRepositoryCheckBox.setSelected(true); panel5.add(createRepositoryCheckBox, cc.xy(1, 1)); //---- repoShortNameTextField ---- repoShortNameTextField.setText("Repo Short Name 1"); panel5.add(repoShortNameTextField, cc.xy(1, 3)); //---- repoNameTextField ---- repoNameTextField.setText("Repo Name 1"); panel5.add(repoNameTextField, cc.xy(1, 5)); //---- repoCodeTextField ---- repoCodeTextField.setText("Organization Code 1"); panel5.add(repoCodeTextField, cc.xy(1, 7)); //---- repoURLTextField ---- repoURLTextField.setText("http://repository.url.org"); panel5.add(repoURLTextField, cc.xy(1, 9)); } contentPanel.add(panel5, cc.xy(1, 9)); //======== panel2 ======== { panel2.setLayout(new FormLayout("default, default:grow, right:default", "default, default, default, fill:default:grow, fill:default:grow, default, fill:default:grow")); //---- label1 ---- label1.setText("Record Type"); panel2.add(label1, cc.xy(1, 1)); //---- label3 ---- label3.setText("Spreadsheet Number (starting at 1)"); panel2.add(label3, cc.xy(2, 1)); //---- label10 ---- label10.setText("Locations"); panel2.add(label10, cc.xy(1, 2)); //---- locationsTextField ---- locationsTextField.setText("1"); panel2.add(locationsTextField, cc.xy(2, 2)); //---- locationsLabel ---- locationsLabel.setText("not supported"); panel2.add(locationsLabel, cc.xy(3, 2)); //---- label5 ---- label5.setText("Subjects"); panel2.add(label5, cc.xy(1, 3)); //---- subjectsTextField ---- subjectsTextField.setColumns(2); subjectsTextField.setText("2"); panel2.add(subjectsTextField, cc.xy(2, 3)); //---- subjectsLabel ---- subjectsLabel.setText("not supported"); panel2.add(subjectsLabel, cc.xy(3, 3)); //---- label4 ---- label4.setText("Names"); panel2.add(label4, cc.xy(1, 4)); //---- namesTextField ---- namesTextField.setColumns(12); namesTextField.setText("3"); panel2.add(namesTextField, cc.xy(2, 4)); //---- namesLabel ---- namesLabel.setText("not supported"); panel2.add(namesLabel, cc.xy(3, 4)); //---- label6 ---- label6.setText("Accessions"); panel2.add(label6, cc.xy(1, 5)); //---- accessionsTextField ---- accessionsTextField.setColumns(2); accessionsTextField.setText("4"); panel2.add(accessionsTextField, cc.xy(2, 5)); //---- accessionsLabel ---- accessionsLabel.setText("not supported"); panel2.add(accessionsLabel, cc.xy(3, 5)); //---- label7 ---- label7.setText("Digital Objects"); panel2.add(label7, cc.xy(1, 6)); //---- digitalObjectsTextField ---- digitalObjectsTextField.setColumns(2); digitalObjectsTextField.setText("5"); panel2.add(digitalObjectsTextField, cc.xy(2, 6)); //---- digitalObjectLabel ---- digitalObjectLabel.setText("not supported"); panel2.add(digitalObjectLabel, cc.xy(3, 6)); //---- label8 ---- label8.setText("Resources"); panel2.add(label8, cc.xy(1, 7)); //---- resourcesTextField ---- resourcesTextField.setText("6, 7"); resourcesTextField.setColumns(2); panel2.add(resourcesTextField, cc.xy(2, 7)); //---- resourcesLabel ---- resourcesLabel.setText("not supported"); panel2.add(resourcesLabel, cc.xy(3, 7)); } contentPanel.add(panel2, cc.xywh(3, 9, 7, 1)); contentPanel.add(separator1, cc.xywh(1, 11, 9, 1)); //---- copyToASpaceButton ---- copyToASpaceButton.setText("Copy To Archives Space"); copyToASpaceButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CopyToASpaceButtonActionPerformed(); } }); contentPanel.add(copyToASpaceButton, cc.xy(1, 13)); //---- hostLabel ---- hostLabel.setText("Archives Space Host"); contentPanel.add(hostLabel, cc.xywh(3, 13, 2, 1)); //---- hostTextField ---- hostTextField.setText("http://localhost:8089"); contentPanel.add(hostTextField, cc.xywh(5, 13, 5, 1)); //---- simulateCheckBox ---- simulateCheckBox.setText("Simulate REST Calls"); simulateCheckBox.setSelected(true); contentPanel.add(simulateCheckBox, cc.xy(1, 15)); //---- adminLabel ---- adminLabel.setText("Administrator User ID"); contentPanel.add(adminLabel, cc.xy(3, 15)); //---- adminTextField ---- adminTextField.setText("admin"); contentPanel.add(adminTextField, cc.xywh(5, 15, 2, 1)); //---- adminPasswordLabel ---- adminPasswordLabel.setText("Password"); contentPanel.add(adminPasswordLabel, cc.xy(7, 15)); //---- adminPasswordTextField ---- adminPasswordTextField.setText("admin"); contentPanel.add(adminPasswordTextField, cc.xy(9, 15)); //---- label2 ---- label2.setText("Target Repository URI"); contentPanel.add(label2, cc.xy(3, 17)); contentPanel.add(repositoryURITextField, cc.xywh(5, 17, 5, 1)); //---- developerModeCheckBox ---- developerModeCheckBox.setText( "Developer Mode (Locations/Names/Subjects are copied once and random IDs are used other records)"); contentPanel.add(developerModeCheckBox, cc.xywh(1, 19, 9, 1)); //---- outputConsoleLabel ---- outputConsoleLabel.setText("Output Console:"); contentPanel.add(outputConsoleLabel, cc.xy(1, 21)); contentPanel.add(copyProgressBar, cc.xywh(3, 21, 7, 1)); //======== scrollPane1 ======== { //---- consoleTextArea ---- consoleTextArea.setRows(12); scrollPane1.setViewportView(consoleTextArea); } contentPanel.add(scrollPane1, cc.xywh(1, 23, 9, 1)); //---- recordURIComboBox ---- recordURIComboBox.setModel(new DefaultComboBoxModel(new String[] { "/repositories", "/users", "/subjects", "/agents/families/1", "/agents/people/1", "/agents/corporate_entities/1", "/repositories/2/accessions/1", "/repositories/2/resources/1", "/repositories/2/archival_objects/1", "/config/enumerations" })); recordURIComboBox.setEditable(true); contentPanel.add(recordURIComboBox, cc.xy(1, 25)); //======== panel1 ======== { panel1.setLayout(new FlowLayout(FlowLayout.LEFT)); //---- paramsLabel ---- paramsLabel.setText("Params"); panel1.add(paramsLabel); //---- paramsTextField ---- paramsTextField.setColumns(20); panel1.add(paramsTextField); } contentPanel.add(panel1, cc.xywh(3, 25, 3, 1)); //---- viewRecordButton ---- viewRecordButton.setText("View"); viewRecordButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { viewRecordButtonActionPerformed(); } }); contentPanel.add(viewRecordButton, cc.xywh(7, 25, 3, 1)); } dialogPane.add(contentPanel, BorderLayout.CENTER); //======== buttonBar ======== { buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER); buttonBar.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.GLUE_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.BUTTON_COLSPEC }, RowSpec.decodeSpecs("pref"))); //---- errorLogButton ---- errorLogButton.setText("View Error Log"); errorLogButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { errorLogButtonActionPerformed(); } }); buttonBar.add(errorLogButton, cc.xy(2, 1)); //---- saveErrorsLabel ---- saveErrorsLabel.setText(" Errors: "); buttonBar.add(saveErrorsLabel, cc.xy(4, 1)); //---- errorCountLabel ---- errorCountLabel.setText("N/A "); errorCountLabel.setForeground(Color.red); errorCountLabel.setFont(new Font("Lucida Grande", Font.BOLD, 13)); buttonBar.add(errorCountLabel, cc.xy(6, 1)); //---- stopButton ---- stopButton.setText("Cancel Copy"); stopButton.setEnabled(false); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { stopButtonActionPerformed(); stopButtonActionPerformed(); } }); buttonBar.add(stopButton, cc.xy(9, 1)); //---- utillitiesButton ---- utillitiesButton.setText("Utilities"); buttonBar.add(utillitiesButton, cc.xy(11, 1)); //---- okButton ---- okButton.setText("Close"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okButtonActionPerformed(); } }); buttonBar.add(okButton, cc.xy(14, 1)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); //---- buttonGroup1 ---- ButtonGroup buttonGroup1 = new ButtonGroup(); buttonGroup1.add(beanShellRadioButton); buttonGroup1.add(jrubyRadioButton); buttonGroup1.add(pythonRadioButton); buttonGroup1.add(javascriptRadioButton); // JFormDesigner - End of component initialization //GEN-END:initComponents }