List of usage examples for java.awt FlowLayout LEFT
int LEFT
To view the source code for java.awt FlowLayout LEFT.
Click Source Link
From source file:org.paxle.desktop.impl.event.MultipleChangesListener.java
public JPanel layoutButtonsDefault(final boolean buttonsRight) { final JPanel buttonPanel = new JPanel( new FlowLayout((buttonsRight) ? FlowLayout.RIGHT : FlowLayout.LEFT, 5, 5)); buttonPanel.add(save);/* w ww .j a v a2s . c o m*/ buttonPanel.add(reset); return buttonPanel; }
From source file:org.nees.rpi.vis.ui.ProfilePlotFrame.java
private void initChartArea() { JFreeChart chart;/*from ww w . j a va 2 s .co m*/ xyDataset = new XYSeriesCollection(); chart = ChartFactory.createXYLineChart(null, "Sensor Reading", "Sensor Depth", xyDataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.WHITE); XYPlot plot = (XYPlot) chart.getPlot(); plot.getDomainAxis().setAutoRange(false); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(true); renderer.setShapesFilled(true); chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); chartPanel.setHorizontalAxisTrace(true); chartPanel.setVerticalAxisTrace(true); chartPanel.setOpaque(false); VisSaveJChartPlotToImageButton saveButton = new VisSaveJChartPlotToImageButton(this, chart); JPanel buttonArea = new JPanel(); buttonArea.setOpaque(false); buttonArea.setLayout(new FlowLayout(FlowLayout.LEFT)); buttonArea.setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 3)); buttonArea.add(saveButton); JPanel chartArea = new JPanel(); chartArea.setOpaque(false); chartArea.setLayout(new BorderLayout()); chartArea.add(chartPanel, BorderLayout.CENTER); chartArea.add(buttonArea, BorderLayout.NORTH); contentPane.add(chartArea, BorderLayout.CENTER); }
From source file:org.jtrfp.trcl.gui.ConfigWindow.java
public ConfigWindow() { setTitle("Settings"); setSize(340, 540);// ww w .jav a 2s . 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:es.emergya.ui.gis.popups.ListaCapas.java
private ListaCapas(CustomMapView mapView, final IMapViewer historyMapViewer) { super();/*ww w. ja v a 2 s . c o m*/ setTitle(i18n.getString("window.gpx.titleBar")); setLocationRelativeTo(getBasicWindow().getFrame()); setResizable(false); setAlwaysOnTop(true); this.mapView = mapView; this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setIconImage(getBasicWindow().getFrame().getIconImage()); JPanel dialogo = new JPanel(new BorderLayout()); dialogo.setBackground(Color.WHITE); dialogo.setBorder(new EmptyBorder(10, 10, 10, 10)); capasGpx = new JPanel(); capasGpx.setBackground(Color.WHITE); capasGpx.setLayout(new BoxLayout(capasGpx, BoxLayout.Y_AXIS)); JScrollPane lista = new JScrollPane(capasGpx); lista.setOpaque(false); lista.setBorder(new TitledBorder(i18n.getString("window.gpx.title"))); dialogo.add(lista, BorderLayout.CENTER); JPanel boton = new JPanel(new FlowLayout()); boton.setOpaque(false); JButton cargar = getCargarGPXButton(); boton.add(cargar, FlowLayout.LEFT); dialogo.add(boton, BorderLayout.SOUTH); add(dialogo); setPreferredSize(new Dimension(400, 250)); pack(); setLocationRelativeTo((Component) mapView); this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { super.windowClosed(e); // historyMapViewer.getGPXButton().setSelected(false); } }); }
From source file:net.sf.jabref.gui.search.SearchBar.java
/** * Initializes the search bar./*from w w w. j a v a2s . c o m*/ * * @param basePanel the base panel */ public SearchBar(BasePanel basePanel) { super(); this.basePanel = Objects.requireNonNull(basePanel); this.searchQueryHighlightObservable = new SearchQueryHighlightObservable(); currentResults.setFont(currentResults.getFont().deriveFont(Font.BOLD)); caseSensitive = new JToggleButton(IconTheme.JabRefIcon.CASE_SENSITIVE.getSmallIcon(), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_CASE_SENSITIVE)); caseSensitive.setToolTipText(Localization.lang("Case sensitive")); caseSensitive.addActionListener(e -> { performSearch(); updatePreferences(); }); regularExp = new JToggleButton(IconTheme.JabRefIcon.REG_EX.getSmallIcon(), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_REG_EXP)); regularExp.setToolTipText(Localization.lang("regular expression")); regularExp.addActionListener(e -> { performSearch(); updatePreferences(); }); openCurrentResultsInDialog = new JButton(IconTheme.JabRefIcon.OPEN_IN_NEW_WINDOW.getSmallIcon()); openCurrentResultsInDialog.setToolTipText(Localization.lang("Show search results in a window")); openCurrentResultsInDialog.addActionListener(ae -> { SearchResultsDialog searchDialog = new SearchResultsDialog(basePanel.frame(), Localization.lang("Search results in database %0 for %1", basePanel.getBibDatabaseContext().getDatabaseFile().getName(), this.getSearchQuery().localize())); List<BibEntry> entries = basePanel.getDatabase().getEntries().stream().filter(BibEntry::isSearchHit) .collect(Collectors.toList()); searchDialog.addEntries(entries, basePanel); searchDialog.selectFirstEntry(); searchDialog.setVisible(true); }); openCurrentResultsInDialog.setEnabled(false); // Init controls setLayout(new WrapLayout(FlowLayout.LEFT)); searchIcon = new JLabel(IconTheme.JabRefIcon.SEARCH.getSmallIcon()); this.add(searchIcon); initSearchField(); if (OS.OS_X) { searchField.putClientProperty("JTextField.variant", "search"); } this.add(searchField); JButton clearSearchButton = new JButton(IconTheme.JabRefIcon.CLOSE.getSmallIcon()); clearSearchButton.setToolTipText(Localization.lang("Clear")); clearSearchButton.addActionListener(l -> endSearch()); this.add(clearSearchButton); searchModeButton = new JButton(); updateSearchModeButtonText(); searchModeButton.addActionListener(l -> toggleSearchModeAndSearch()); JToolBar toolBar = new OSXCompatibleToolbar(); toolBar.setFloatable(false); toolBar.add(clearSearchButton); toolBar.addSeparator(); toolBar.add(regularExp); toolBar.add(caseSensitive); toolBar.addSeparator(); toolBar.add(searchModeButton); toolBar.addSeparator(); toolBar.add(openCurrentResultsInDialog); globalSearch = new JButton(Localization.lang("Search globally")); globalSearch.setToolTipText(Localization.lang("Search in all open databases")); globalSearch.addActionListener(l -> { AbstractWorker worker = new GlobalSearchWorker(basePanel.frame(), getSearchQuery()); worker.run(); worker.update(); }); globalSearch.setEnabled(false); toolBar.add(globalSearch); toolBar.addSeparator(); toolBar.add(new HelpAction(HelpFile.SEARCH)); this.add(toolBar); this.add(currentResults); paintBackgroundWhite(this); }
From source file:captureplugin.drivers.defaultdriver.AdditionalParams.java
/** * Create List-Panel/* ww w . jav a 2 s.co m*/ * @return List-Panel */ private Component createListPanel() { JPanel panel = new JPanel(new BorderLayout(0, 2)); panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); panel.add(new JLabel(mLocalizer.msg("command", "Command")), BorderLayout.NORTH); mList = new JList(mListModel); panel.add(new JScrollPane(mList), BorderLayout.CENTER); JPanel buttons = new JPanel(new FlowLayout(FlowLayout.LEFT)); JButton add = new JButton(TVBrowserIcons.newIcon(TVBrowserIcons.SIZE_SMALL)); add.setToolTipText(Localizer.getLocalization(Localizer.I18N_ADD)); add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addPressed(); } }); buttons.add(add); JButton remove = new JButton(TVBrowserIcons.delete(TVBrowserIcons.SIZE_SMALL)); remove.setToolTipText(Localizer.getLocalization(Localizer.I18N_DELETE)); remove.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removePressed(); } }); buttons.add(remove); final JButton up = new JButton(TVBrowserIcons.up(TVBrowserIcons.SIZE_SMALL)); up.setToolTipText(Localizer.getLocalization(Localizer.I18N_UP)); buttons.add(up); up.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { upPressed(); } }); final JButton down = new JButton(TVBrowserIcons.down(TVBrowserIcons.SIZE_SMALL)); down.setToolTipText(Localizer.getLocalization(Localizer.I18N_DOWN)); buttons.add(down); down.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { downPressed(); } }); mStartStop = new JButton(mStartIcon); mStartStop.setToolTipText(mLocalizer.msg("startstop", "Activate or Deactivate Parameter")); mStartStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startStopPressed(); } }); buttons.add(mStartStop); panel.add(buttons, BorderLayout.SOUTH); mList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { selectionChanged(); if (mList.getSelectedIndex() == 0) { up.setEnabled(false); down.setEnabled(true); } else if (mList.getSelectedIndex() == mListModel.getSize() - 1) { up.setEnabled(true); down.setEnabled(false); } else { up.setEnabled(true); down.setEnabled(true); } } }); selectionChanged(); return panel; }
From source file:GCWrapper.java
/** * Creates and lays out components in the container. See the comments below * for an organizational overview by panel. *///from w ww. j a v a2 s.co m private void initComponents(Container c) { c.setLayout(new BorderLayout()); // Graphics Config JPanel gcPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); c.add(gcPanel, BorderLayout.NORTH); gcSelection.setPreferredSize(new Dimension(400, 30)); gcPanel.add(gcSelection); // Capabilities JPanel capsPanel = new JPanel(new BorderLayout()); c.add(capsPanel, BorderLayout.CENTER); // Image Capabilities JPanel imageCapsPanel = new JPanel(new GridLayout(2, 1)); capsPanel.add(imageCapsPanel, BorderLayout.NORTH); imageCapsPanel.setBorder(BorderFactory.createTitledBorder("Image Capabilities")); imageAccelerated.setEnabled(false); imageCapsPanel.add(imageAccelerated); imageTrueVolatile.setEnabled(false); imageCapsPanel.add(imageTrueVolatile); // Buffer Capabilities JPanel bufferCapsPanel = new JPanel(new BorderLayout()); capsPanel.add(bufferCapsPanel, BorderLayout.CENTER); bufferCapsPanel.setBorder(BorderFactory.createTitledBorder("Buffer Capabilities")); // Buffer Access JPanel bufferAccessCapsPanel = new JPanel(new GridLayout(3, 1)); bufferAccessCapsPanel.setPreferredSize(new Dimension(300, 88)); bufferCapsPanel.add(bufferAccessCapsPanel, BorderLayout.NORTH); // Flipping JPanel flippingPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(flippingPanel); flippingPanel.add(flipping); flipping.setEnabled(false); flippingPanel.add(flippingMethod); // Full-screen JPanel fsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(fsPanel); JPanel indentPanel = new JPanel(); indentPanel.setPreferredSize(new Dimension(30, 30)); fsPanel.add(indentPanel); fsPanel.add(fullScreen); fullScreen.setEnabled(false); // Multi-buffering JPanel mbPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(mbPanel); indentPanel = new JPanel(); indentPanel.setPreferredSize(new Dimension(30, 30)); mbPanel.add(indentPanel); mbPanel.add(multiBuffer); multiBuffer.setEnabled(false); // Front and Back Buffer Capabilities JPanel buffersPanel = new JPanel(new GridLayout(1, 2)); bufferCapsPanel.add(buffersPanel, BorderLayout.CENTER); // Front Buffer JPanel fbPanel = new JPanel(new GridLayout(2, 1)); fbPanel.setBorder(BorderFactory.createTitledBorder("Front Buffer")); buffersPanel.add(fbPanel); fbPanel.add(fbAccelerated); fbAccelerated.setEnabled(false); fbPanel.add(fbTrueVolatile); fbTrueVolatile.setEnabled(false); // Back Buffer JPanel bbPanel = new JPanel(new GridLayout(2, 1)); bbPanel.setPreferredSize(new Dimension(250, 80)); bbPanel.setBorder(BorderFactory.createTitledBorder("Back and Intermediate Buffers")); buffersPanel.add(bbPanel); bbPanel.add(bbAccelerated); bbAccelerated.setEnabled(false); bbPanel.add(bbTrueVolatile); bbTrueVolatile.setEnabled(false); }
From source file:org.eobjects.datacleaner.widgets.result.PatternFinderResultSwingRendererCrosstabDelegate.java
@Override protected void decorate(CrosstabResult result, DCTable table, DisplayChartCallback displayChartCallback) { super.decorate(result, table, displayChartCallback); table.setAlignment(1, Alignment.RIGHT); final int rowCount = table.getRowCount(); for (int i = 0; i < rowCount; i++) { final Object expressionObject = table.getValueAt(i, 0); final String label = extractString(expressionObject); final String expression = extractExpression(label); final String stringPatternName = "PF: " + label; if (!_catalog.containsStringPattern(stringPatternName)) { DCPanel panel = new DCPanel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.add(Box.createHorizontalStrut(4)); panel.add(new JLabel(label)); final JButton button = WidgetFactory.createSmallButton("images/actions/save.png"); button.setToolTipText("Save as string pattern"); button.addActionListener(new ActionListener() { @Override/* w ww. j ava 2s . c om*/ public void actionPerformed(ActionEvent e) { _catalog.addStringPattern(new SimpleStringPattern(stringPatternName, expression)); button.setEnabled(false); } }); panel.add(Box.createHorizontalStrut(4)); panel.add(button); table.setValueAt(panel, i, 0); } } if (isInitiallyCharted(table)) { displayChart(table, displayChartCallback); } }
From source file:org.datacleaner.widgets.result.PatternFinderResultSwingRendererCrosstabDelegate.java
@Override protected void decorate(CrosstabResult result, DCTable table, DisplayChartCallback displayChartCallback) { super.decorate(result, table, displayChartCallback); table.setAlignment(1, Alignment.RIGHT); final int rowCount = table.getRowCount(); for (int i = 0; i < rowCount; i++) { final Object expressionObject = table.getValueAt(i, 0); final String label = extractString(expressionObject); final String expression = extractExpression(label); final String stringPatternName = "PF: " + label; if (!_catalog.containsStringPattern(stringPatternName)) { DCPanel panel = new DCPanel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.add(Box.createHorizontalStrut(4)); panel.add(new JLabel(label)); final JButton button = WidgetFactory.createSmallButton(IconUtils.ACTION_SAVE_DARK); button.setToolTipText("Save as string pattern"); button.addActionListener(new ActionListener() { @Override//from w w w.ja va 2 s. c o m public void actionPerformed(ActionEvent e) { _catalog.addStringPattern(new SimpleStringPattern(stringPatternName, expression)); button.setEnabled(false); } }); panel.add(Box.createHorizontalStrut(4)); panel.add(button); table.setValueAt(panel, i, 0); } } if (isInitiallyCharted(table)) { displayChart(table, displayChartCallback); } }
From source file:org.rdv.ui.ConsoleDialog.java
public ConsoleDialog(JDialog owner) { super(owner); setName("consoleDialog"); setDefaultCloseOperation(AboutDialog.DISPOSE_ON_CLOSE); JPanel container = new JPanel(); container.setLayout(new BorderLayout()); container.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); setContentPane(container);// w w w. j a v a 2s . c om InputMap inputMap = container.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap actionMap = container.getActionMap(); Action disposeAction = new AbstractAction() { /** serialized version identifier */ private static final long serialVersionUID = 4380189911762232261L; public void actionPerformed(ActionEvent ae) { dispose(); } }; Action copyAction = new AbstractAction() { /** serialized version identifier */ private static final long serialVersionUID = 2596081241883913660L; public void actionPerformed(ActionEvent e) { textArea.selectAll(); textArea.copy(); } }; // Action scrollLockAction = new AbstractAction() { // /** serialized version identifier */ // private static final long serialVersionUID = -8089076016097529064L; // // public void actionPerformed(ActionEvent e) { // //toggle scroll lock // scrollLock_=!scrollLock_; // } // }; disposeAction.putValue(Action.NAME, "OK"); inputMap.put(KeyStroke.getKeyStroke("ENTER"), "dispose"); inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), "dispose"); actionMap.put("dispose", disposeAction); copyAction.putValue(Action.NAME, "Copy"); actionMap.put("copy", copyAction); // actionMap.put("scroll lock", scrollLockAction); // scrollLockAction.putValue(Action.NAME, "Scroll Lock"); textArea = new JTextArea(); textArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); textArea.setBackground(Color.WHITE); textArea.setForeground(Color.BLACK); textArea.setEditable(false); textArea.setLineWrap(false); Iterator<String> msgIt = messageBuffer.getMessages().iterator(); //add all the messages in the buffer to this point while (msgIt.hasNext()) { addMessage(msgIt.next()); } JScrollPane scrollPane = new JScrollPane(textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setPreferredSize(new Dimension(640, 480)); container.add(scrollPane, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BorderLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JButton okButton = new JButton(disposeAction); buttonPanel.add(okButton, BorderLayout.EAST); JPanel leftBtnsPanel = new JPanel(); leftBtnsPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); buttonPanel.add(leftBtnsPanel, BorderLayout.WEST); JButton copyButton = new JButton(copyAction); leftBtnsPanel.add(copyButton); // JButton scrollLockButton = new JButton(scrollLockAction); // leftBtnsPanel.add(scrollLockButton); container.add(buttonPanel, BorderLayout.SOUTH); // inject resources from the properties for this component ResourceMap resourceMap = RDV.getInstance().getContext().getResourceMap(getClass()); resourceMap.injectComponents(this); pack(); okButton.requestFocusInWindow(); setLocationByPlatform(true); setVisible(true); messageBuffer.addObserver(this); }