List of usage examples for javax.swing JSeparator JSeparator
public JSeparator(int orientation)
From source file:org.tinymediamanager.ui.dialogs.ImageChooserDialog.java
/** * Instantiates a new image chooser dialog. * // w w w .ja v a 2 s . com * @param ids * the ids * @param type * the type * @param artworkScrapers * the artwork providers * @param imageLabel * the image label * @param extraThumbs * the extra thumbs * @param extraFanarts * the extra fanarts * @param mediaType * the media for for which artwork has to be chosen */ public ImageChooserDialog(final HashMap<String, Object> ids, ImageType type, List<MediaScraper> artworkScrapers, ImageLabel imageLabel, List<String> extraThumbs, List<String> extraFanarts, MediaType mediaType) { super("", "imageChooser"); this.imageLabel = imageLabel; this.type = type; this.mediaType = mediaType; this.artworkScrapers = artworkScrapers; this.extraThumbs = extraThumbs; this.extraFanarts = extraFanarts; switch (type) { case FANART: setTitle(BUNDLE.getString("image.choose.fanart")); //$NON-NLS-1$ break; case POSTER: setTitle(BUNDLE.getString("image.choose.poster")); //$NON-NLS-1$ break; case BANNER: setTitle(BUNDLE.getString("image.choose.banner")); //$NON-NLS-1$ break; case SEASON: Object season = ids.get("tvShowSeason"); if (season != null) { setTitle(BUNDLE.getString("image.choose.season") + " - " + BUNDLE.getString("metatag.season") + " " //$NON-NLS-1$ + season); } else { setTitle(BUNDLE.getString("image.choose.season")); //$NON-NLS-1$ } break; case CLEARART: setTitle(BUNDLE.getString("image.choose.clearart")); //$NON-NLS-1$ break; case DISC: setTitle(BUNDLE.getString("image.choose.disc")); //$NON-NLS-1$ break; case LOGO: setTitle(BUNDLE.getString("image.choose.logo")); //$NON-NLS-1$ break; case CLEARLOGO: setTitle(BUNDLE.getString("image.choose.clearlogo")); //$NON-NLS-1$ break; case THUMB: setTitle(BUNDLE.getString("image.choose.thumb")); //$NON-NLS-1$ break; } setBounds(5, 5, 1000, 590); getContentPane().setLayout(new BorderLayout()); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("258px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:266px:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, })); { scrollPane = new JScrollPane(); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); contentPanel.add(scrollPane, "2, 2, 3, 1, fill, fill"); { panelImages = new JPanel(); scrollPane.setViewportView(panelImages); scrollPane.getVerticalScrollBar().setUnitIncrement(16); panelImages.setLayout(new WrapLayout(FlowLayout.LEFT)); } } { tfImageUrl = new EnhancedTextField(BUNDLE.getString("image.inserturl")); //$NON-NLS-1$ contentPanel.add(tfImageUrl, "2, 4, fill, default"); tfImageUrl.setColumns(10); JButton btnAddImage = new JButton(BUNDLE.getString("image.downloadimage")); //$NON-NLS-1$ btnAddImage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotBlank(tfImageUrl.getText())) { downloadAndPreviewImage(tfImageUrl.getText()); } } }); contentPanel.add(btnAddImage, "4, 4"); } { JPanel bottomPane = new JPanel(); getContentPane().add(bottomPane, BorderLayout.SOUTH); bottomPane.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("23px:grow"), FormFactory.RELATED_GAP_ROWSPEC, })); { if (type == ImageType.FANART && extraFanarts != null && extraThumbs != null) { JPanel panelExtraButtons = new JPanel(); bottomPane.add(panelExtraButtons, "2, 2, fill, bottom"); panelExtraButtons.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0)); { if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs()) { JLabel labelThumbs = new JLabel("Extrathumbs:"); panelExtraButtons.add(labelThumbs); JButton btnMarkExtrathumbs = new JButton(""); btnMarkExtrathumbs.setMargin(new Insets(0, 0, 0, 0)); btnMarkExtrathumbs.setIcon(IconManager.CHECK_ALL); btnMarkExtrathumbs.setToolTipText(BUNDLE.getString("image.extrathumbs.markall")); //$NON-NLS-1$ btnMarkExtrathumbs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button .getClientProperty("MediaArtworkExtrathumb") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrathumb"); chkbx.setSelected(true); } } } }); panelExtraButtons.add(btnMarkExtrathumbs); JButton btnUnMarkExtrathumbs = new JButton(""); btnUnMarkExtrathumbs.setMargin(new Insets(0, 0, 0, 0)); btnUnMarkExtrathumbs.setIcon(IconManager.UNCHECK_ALL); btnUnMarkExtrathumbs.setToolTipText(BUNDLE.getString("image.extrathumbs.unmarkall")); //$NON-NLS-1$ btnUnMarkExtrathumbs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button .getClientProperty("MediaArtworkExtrathumb") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrathumb"); chkbx.setSelected(false); } } } }); panelExtraButtons.add(btnUnMarkExtrathumbs); } if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs() && MovieModuleManager.MOVIE_SETTINGS.isImageExtraFanart()) { JSeparator separator = new JSeparator(SwingConstants.VERTICAL); separator.setPreferredSize(new Dimension(2, 16)); panelExtraButtons.add(separator); } if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraFanart()) { JLabel labelFanart = new JLabel("Extrafanart:"); panelExtraButtons.add(labelFanart); JButton btnMarkExtrafanart = new JButton(""); btnMarkExtrafanart.setMargin(new Insets(0, 0, 0, 0)); btnMarkExtrafanart.setIcon(IconManager.CHECK_ALL); btnMarkExtrafanart.setToolTipText(BUNDLE.getString("image.extrafanart.markall")); //$NON-NLS-1$ btnMarkExtrafanart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button.getClientProperty( "MediaArtworkExtrafanart") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrafanart"); chkbx.setSelected(true); } } } }); panelExtraButtons.add(btnMarkExtrafanart); JButton btnUnMarkExtrafanart = new JButton(""); btnUnMarkExtrafanart.setMargin(new Insets(0, 0, 0, 0)); btnUnMarkExtrafanart.setIcon(IconManager.UNCHECK_ALL); btnUnMarkExtrafanart.setToolTipText(BUNDLE.getString("image.extrafanart.unmarkall")); //$NON-NLS-1$ btnUnMarkExtrafanart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button.getClientProperty( "MediaArtworkExtrafanart") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrafanart"); chkbx.setSelected(false); } } } }); panelExtraButtons.add(btnUnMarkExtrafanart); } } } } { progressBar = new JProgressBar(); bottomPane.add(progressBar, "2, 4"); } { lblProgressAction = new JLabel(""); bottomPane.add(lblProgressAction, "4, 4"); } { JPanel buttonPane = new JPanel(); EqualsLayout layout = new EqualsLayout(5); buttonPane.setLayout(layout); layout.setMinWidth(100); bottomPane.add(buttonPane, "6, 4, fill, top"); JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ okButton.setAction(actionOK); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); JButton btnAddFile = new JButton(BUNDLE.getString("Button.addfile")); //$NON-NLS-1$ btnAddFile.setAction(actionLocalFile); buttonPane.add(btnAddFile); JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ cancelButton.setAction(actionCancel); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } task = new DownloadTask(ids, this.artworkScrapers); task.execute(); }
From source file:org.ut.biolab.medsavant.client.view.UpdatesPanel.java
private JSeparator createSeparator() { JSeparator sep = new JSeparator(JSeparator.HORIZONTAL); sep.setMaximumSize(new Dimension(1000, 1)); sep.setBackground(Color.WHITE); sep.setForeground(Color.LIGHT_GRAY); return sep;/*from w ww .j a v a 2s . c o m*/ }
From source file:pl.otros.logview.gui.LogViewPanel.java
public LogViewPanel(final LogDataTableModel dataTableModel, TableColumns[] visibleColumns, final OtrosApplication otrosApplication) { super();//from w w w .j av a 2 s . c o m this.dataTableModel = dataTableModel; this.otrosApplication = otrosApplication; this.statusObserver = otrosApplication.getStatusObserver(); configuration = otrosApplication.getConfiguration(); AllPluginables allPluginable = AllPluginables.getInstance(); markersContainer = allPluginable.getMarkersContainser(); markersContainer.addListener(new MarkersMenuReloader()); logFiltersContainer = allPluginable.getLogFiltersContainer(); messageColorizersContainer = allPluginable.getMessageColorizers(); messageFormattersContainer = allPluginable.getMessageFormatters(); selectedMessageColorizersContainer = new PluginableElementsContainer<MessageColorizer>(); selectedMessageFormattersContainer = new PluginableElementsContainer<MessageFormatter>(); for (MessageColorizer messageColorizer : messageColorizersContainer.getElements()) { selectedMessageColorizersContainer.addElement(messageColorizer); } for (MessageFormatter messageFormatter : messageFormattersContainer.getElements()) { selectedMessageFormattersContainer.addElement(messageFormatter); } messageColorizersContainer.addListener( new SynchronizePluginableContainerListener<MessageColorizer>(selectedMessageColorizersContainer)); messageFormattersContainer.addListener( new SynchronizePluginableContainerListener<MessageFormatter>(selectedMessageFormattersContainer)); menuLabelFont = new JLabel().getFont().deriveFont(Font.BOLD); filtersPanel = new JPanel(); logsTablePanel = new JPanel(); logsMarkersPanel = new JPanel(); leftPanel = new JPanel(new MigLayout()); logDetailTextArea = new JTextPane(); logDetailTextArea.setEditable(false); MouseAdapter locationInfo = new LocationClickMouseAdapter(otrosApplication, logDetailTextArea); logDetailTextArea.addMouseMotionListener(locationInfo); logDetailTextArea.addMouseListener(locationInfo); logDetailTextArea.setBorder(BorderFactory.createTitledBorder("Details")); logDetailWithRulerScrollPane = RulerBarHelper.wrapTextComponent(logDetailTextArea); table = new JTableWith2RowHighliting(dataTableModel); // Initialize default column visible before creating context menu table.setColumnControlVisible(true); final ColumnControlButton columnControlButton = new ColumnControlButton(table) { @Override public void togglePopup() { populatePopup(); super.togglePopup(); } @Override protected List<Action> getAdditionalActions() { final List<Action> additionalActions = super.getAdditionalActions(); final AbstractAction saveLayout = new AbstractAction("Save current to new column layout", Icons.DISK) { @Override public void actionPerformed(ActionEvent actionEvent) { String newLayoutName = JOptionPane.showInputDialog(table, "New Layout name"); if (newLayoutName == null) { return; } newLayoutName = newLayoutName.trim(); LOGGER.info(String.format("Saving New column layout '%s'", newLayoutName)); ArrayList<String> visibleColNames = new ArrayList<String>(); for (TableColumn tc : table.getColumns()) { Object o = tc.getIdentifier(); if (!(o instanceof TableColumns)) { LOGGER.severe("TableColumn identifier of unexpected type: " + tc.getIdentifier().getClass().getName()); LOGGER.warning("Throw up a pop-up"); return; } TableColumns tcs = (TableColumns) o; visibleColNames.add(tcs.getName()); } ColumnLayout columnLayout = new ColumnLayout(newLayoutName, visibleColNames); final List<ColumnLayout> columnLayouts = LogTableFormatConfigView .loadColumnLayouts(configuration); columnLayouts.add(columnLayout); LogTableFormatConfigView.saveColumnLayouts(columnLayouts, configuration); populatePopup(); } }; additionalActions.add(saveLayout); final List<ColumnLayout> columnLayoutNames = LogTableFormatConfigView .loadColumnLayouts(configuration); for (final ColumnLayout columnLayout : columnLayoutNames) { final String name = columnLayout.getName(); final AbstractAction applyColumnLayout = new ApplyColumnLayoutAction(name, Icons.EDIT_COLUMNS, columnLayout, table); additionalActions.add(applyColumnLayout); } return additionalActions; } }; table.setColumnControl(columnControlButton); List<TableColumn> columns = table.getColumns(true); for (int i = 0; i < columns.size(); i++) { columns.get(i).setIdentifier(TableColumns.getColumnById(i)); } for (TableColumn tableColumn : columns) { table.getColumnExt(tableColumn.getIdentifier()).setVisible(false); } for (TableColumns tableColumns : visibleColumns) { table.getColumnExt(tableColumns).setVisible(true); } table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); updateColumnsSize(); table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); final Renderers renderers = Renderers.getInstance(otrosApplication); table.setDefaultRenderer(String.class, new TableMarkDecoratorRenderer(renderers.getStringRenderer())); table.setDefaultRenderer(Object.class, new TableMarkDecoratorRenderer(table.getDefaultRenderer(Object.class))); table.setDefaultRenderer(Integer.class, new TableMarkDecoratorRenderer(table.getDefaultRenderer(Object.class))); table.setDefaultRenderer(Level.class, new TableMarkDecoratorRenderer(renderers.getLevelRenderer())); table.setDefaultRenderer(Date.class, new TableMarkDecoratorRenderer(renderers.getDateRenderer())); final TimeDeltaRenderer timeDeltaRenderer = new TimeDeltaRenderer(); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent listSelectionEvent) { final int[] selectedRows = table.getSelectedRows(); if (selectedRows.length > 0) { final int selectedRow = selectedRows[selectedRows.length - 1]; final Date selectedDate = dataTableModel.getLogData(table.convertRowIndexToModel(selectedRow)) .getDate(); timeDeltaRenderer.setSelectedTimestamp(selectedDate); table.repaint(); } } }); table.setDefaultRenderer(TimeDelta.class, new TableMarkDecoratorRenderer(timeDeltaRenderer)); ((EventSource) configuration.getConfiguration()).addConfigurationListener(new ConfigurationListener() { @Override public void configurationChanged(ConfigurationEvent ce) { if (ce.getType() == AbstractConfiguration.EVENT_SET_PROPERTY && !ce.isBeforeUpdate()) { if (ce.getPropertyName().equals(ConfKeys.LOG_TABLE_FORMAT_DATE_FORMAT)) { table.setDefaultRenderer(Date.class, new TableMarkDecoratorRenderer(new DateRenderer( configuration.getString(ConfKeys.LOG_TABLE_FORMAT_DATE_FORMAT, "HH:mm:ss.SSS")))); updateTimeColumnSize(); } else if (ce.getPropertyName().equals(ConfKeys.LOG_TABLE_FORMAT_LEVEL_RENDERER)) { table.setDefaultRenderer(Level.class, new TableMarkDecoratorRenderer(new LevelRenderer(configuration.get( LevelRenderer.Mode.class, ConfKeys.LOG_TABLE_FORMAT_LEVEL_RENDERER, LevelRenderer.Mode.IconsOnly)))); updateLevelColumnSize(); } } } }); table.setDefaultRenderer(Boolean.class, new TableMarkDecoratorRenderer(table.getDefaultRenderer(Boolean.class))); table.setDefaultRenderer(Note.class, new TableMarkDecoratorRenderer(new NoteRenderer())); table.setDefaultRenderer(MarkerColors.class, new TableMarkDecoratorRenderer(new MarkTableRenderer())); table.setDefaultEditor(Note.class, new NoteTableEditor()); table.setDefaultEditor(MarkerColors.class, new MarkTableEditor(otrosApplication)); table.setDefaultRenderer(ClassWrapper.class, new TableMarkDecoratorRenderer(renderers.getClassWrapperRenderer())); sorter = new TableRowSorter<LogDataTableModel>(dataTableModel); for (int i = 0; i < dataTableModel.getColumnCount(); i++) { sorter.setSortable(i, false); } sorter.setSortable(TableColumns.ID.getColumn(), true); sorter.setSortable(TableColumns.TIME.getColumn(), true); table.setRowSorter(sorter); messageDetailListener = new MessageDetailListener(this, dateFormat, selectedMessageFormattersContainer, selectedMessageColorizersContainer); table.getSelectionModel().addListSelectionListener(messageDetailListener); dataTableModel.addNoteObserver(messageDetailListener); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { boolean hasFocus = otrosApplication.getApplicationJFrame().isFocused(); final boolean enabled = otrosApplication.getConfiguration() .getBoolean(ConfKeys.JUMP_TO_CODE_AUTO_JUMP_ENABLED, false); if (hasFocus && enabled && !e.getValueIsAdjusting()) { try { final LogData logData = dataTableModel .getLogData(table.convertRowIndexToModel(e.getFirstIndex())); LocationInfo li = new LocationInfo(logData.getClazz(), logData.getMethod(), logData.getFile(), Integer.valueOf(logData.getLine())); final JumpToCodeService jumpToCodeService = otrosApplication.getServices() .getJumpToCodeService(); final boolean ideAvailable = jumpToCodeService.isIdeAvailable(); if (ideAvailable) { LOGGER.fine("Jumping to " + li); jumpToCodeService.jump(li); } } catch (Exception e1) { LOGGER.warning("Can't perform jump to code " + e1.getMessage()); } } } }); notes = new JTextArea(); notes.setEditable(false); NoteObserver allNotesObserver = new AllNotesTextAreaObserver(notes); dataTableModel.addNoteObserver(allNotesObserver); addFiltersGUIsToPanel(filtersPanel); logsTablePanel.setLayout(new BorderLayout()); logsTablePanel.add(new JScrollPane(table)); JPanel messageDetailsPanel = new JPanel(new BorderLayout()); messageDetailToolbar = new JToolBar("MessageDetail"); messageDetailsPanel.add(messageDetailToolbar, BorderLayout.NORTH); messageDetailsPanel.add(logDetailWithRulerScrollPane); initMessageDetailsToolbar(); jTabbedPane = new JTabbedPane(); jTabbedPane.add("Message detail", messageDetailsPanel); jTabbedPane.add("All notes", new JScrollPane(notes)); leftPanel.add(filtersPanel, "wrap, growx"); leftPanel.add(new JSeparator(SwingConstants.HORIZONTAL), "wrap,growx"); leftPanel.add(logsMarkersPanel, "wrap,growx"); JSplitPane splitPaneLogsTableAndDetails = new JSplitPane(JSplitPane.VERTICAL_SPLIT, logsTablePanel, jTabbedPane); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), splitPaneLogsTableAndDetails); splitPane.setOneTouchExpandable(true); this.setLayout(new BorderLayout()); this.add(splitPane); splitPaneLogsTableAndDetails.setDividerLocation(0.5d); splitPaneLogsTableAndDetails.setOneTouchExpandable(true); splitPane.setDividerLocation(leftPanel.getPreferredSize().width + 10); PopupListener popupListener = new PopupListener(new Callable<JPopupMenu>() { @Override public JPopupMenu call() throws Exception { return initTableContextMenu(); } }); table.addMouseListener(popupListener); table.addKeyListener(popupListener); PopupListener popupListenerMessageDetailMenu = new PopupListener(new Callable<JPopupMenu>() { @Override public JPopupMenu call() throws Exception { return initMessageDetailPopupMenu(); } }); logDetailTextArea.addMouseListener(popupListenerMessageDetailMenu); logDetailTextArea.addKeyListener(popupListenerMessageDetailMenu); dataTableModel.notifyAllNoteObservers(new NoteEvent(EventType.CLEAR, dataTableModel, null, 0)); table.addKeyListener(new MarkRowBySpaceKeyListener(otrosApplication)); initAcceptConditions(); }
From source file:savant.util.swing.TrackChooser.java
private void initLayout() { this.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); //FILLER/*from w w w . j a v a2 s.c o m*/ //LEFT LABEL JLabel leftLabel = new JLabel("All Tracks"); leftLabel.setFont(new Font(null, Font.BOLD, 12)); c.gridx = 0; c.gridy = 0; c.insets = new Insets(5, 5, 5, 5); add(leftLabel, c); // RIGHT LABEL JLabel rightLabel = new JLabel("Selected Tracks"); rightLabel.setFont(new Font(null, Font.BOLD, 12)); c.gridx = 2; c.gridwidth = GridBagConstraints.REMAINDER; add(rightLabel, c); //LEFT LIST leftList = new JList(); JScrollPane leftScroll = new JScrollPane(); leftScroll.setViewportView(leftList); leftScroll.setMinimumSize(new Dimension(450, 300)); leftScroll.setPreferredSize(new Dimension(450, 300)); c.weightx = 1.0; c.weighty = 1.0; c.gridx = 0; c.gridy = 1; c.gridwidth = 1; c.gridheight = 4; add(leftScroll, c); //RIGHT LIST rightList = new JList(); JScrollPane rightScroll = new JScrollPane(); rightScroll.setViewportView(rightList); rightScroll.setMinimumSize(new Dimension(450, 300)); rightScroll.setPreferredSize(new Dimension(450, 300)); c.gridx = 2; c.gridwidth = GridBagConstraints.REMAINDER; this.add(rightScroll, c); // MOVE RIGHT c.weightx = 0.0; c.weighty = 0.5; c.gridx = 1; c.gridy = 1; c.gridwidth = 1; c.gridheight = 1; add(createMoveRight(), c); // MOVE LEFT c.gridy = 2; add(createMoveLeft(), c); // ALL RIGHT c.gridy = 3; add(createAllRight(), c); //ALL LEFT c.gridy = 4; this.add(createAllLeft(), c); //FILTER c.gridx = 0; c.gridy = 5; add(createFilterPanel(), c); //AUTO SELECT ALL c.gridx = 2; add(createSelectAllCheck(), c); //SEPARATOR JSeparator separator1 = new JSeparator(SwingConstants.HORIZONTAL); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = GridBagConstraints.RELATIVE; c.weightx = 1.0; c.gridwidth = GridBagConstraints.REMAINDER; add(separator1, c); if (selectBase) { //SELECT BASE PANEL JPanel selectBasePanel = new JPanel(new BorderLayout()); c.gridwidth = 2; add(selectBasePanel, c); //SELECT BASE LABEL JLabel selectBaseLabel = new JLabel("(Optional) Select Base: "); selectBasePanel.add(selectBaseLabel, BorderLayout.WEST); //SELECT BASE FIELD selectBaseField = new JTextField(); selectBasePanel.add(selectBaseField, BorderLayout.CENTER); //SELECT BASE EXAMPLE JLabel selectBaseExample = new JLabel(" ex. 123,456,789"); selectBasePanel.add(selectBaseExample, BorderLayout.EAST); //SEPARATOR JSeparator separator2 = new JSeparator(SwingConstants.HORIZONTAL); c.gridwidth = GridBagConstraints.REMAINDER; add(separator2, c); } JPanel okCancelPanel = new JPanel(new BorderLayout()); c.anchor = GridBagConstraints.EAST; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.0; c.fill = GridBagConstraints.NONE; add(okCancelPanel, c); //OK okCancelPanel.add(createOKButton(), BorderLayout.CENTER); //CANCEL okCancelPanel.add(createCancelButton(), BorderLayout.EAST); pack(); }
From source file:uk.ac.soton.mib104.t2.activities.json.ui.config.JSONPathConfigurationPanel.java
protected void initGui() { this.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); this.setLayout(new GridBagLayout()); jsonPathAsTextField.setMinimumSize(new Dimension(240, jsonPathAsTextField.getMinimumSize().height)); jsonPathAsTextField.setPreferredSize(jsonPathAsTextField.getMinimumSize()); jsonPathAsTextField.setText(""); jsonPathButton.addActionListener(new ActionListener() { @Override//from w ww . j a v a2 s. com public void actionPerformed(final ActionEvent e) { final JSONPathInputDialog jsonPathInputDialog = new JSONPathInputDialog( SwingUtilities.getWindowAncestor(JSONPathConfigurationPanel.this)); final JSONPathInputPanel jsonPathInputPane = jsonPathInputDialog.getJSONPathInputPane(); jsonPathInputPane.getJSONDocumentEditorPane().setText(jsonPathInputDialog_jsonPathEditorPane_text); jsonPathInputPane.getJsonPathEditorPane() .setJSONValue(jsonPathInputDialog_jsonPathEditorPane_value); jsonPathInputPane.getJsonPathEditorPane() .setTreeVisible(jsonPathInputDialog_jsonPathEditorPane_treeVisible); jsonPathInputPane.getJsonPathEditorPane().setText(jsonPathAsTextField.getText()); jsonPathInputDialog.setVisible(true); switch (jsonPathInputDialog.getOption()) { case JOptionPane.OK_OPTION: break; default: return; } jsonPathInputDialog_jsonPathEditorPane_text = jsonPathInputPane.getJSONDocumentEditorPane() .getText(); jsonPathInputDialog_jsonPathEditorPane_treeVisible = jsonPathInputPane.getJsonPathEditorPane() .isTreeVisible(); jsonPathInputDialog_jsonPathEditorPane_value = jsonPathInputPane.getJsonPathEditorPane() .getJSONValue(); jsonPathAsTextField.setText(jsonPathInputPane.getJsonPathEditorPane().getText()); } }); jsonPathButton.setFont(jsonPathButton.getFont().deriveFont(11f)); jsonPathButton.setIcon(JSONPathServiceIcon.getIcon()); jsonPathButton.setText(jsonPathButtonText); jsonPathButton.setToolTipText(jsonPathButtonTip); final JLabel portDepthLabel = new JLabel(); portDepthLabel.setFont(portDepthLabel.getFont().deriveFont(11f)); portDepthLabel.setHorizontalAlignment(JLabel.LEFT); portDepthLabel.setIcon(Silk.getHelpIcon()); portDepthLabel.setText(portDepthInputPaneText); portDepthLabel.setToolTipText(portDepthInputPaneTip); final GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 0; constraints.anchor = GridBagConstraints.WEST; this.add(JSONPathTextField.createLabelForDocument(jsonPathAsTextField.getDocument()), constraints); constraints.gridx++; constraints.anchor = GridBagConstraints.EAST; constraints.weightx = 1d; this.add(jsonPathAsTextField, constraints); constraints.weightx = 0; constraints.gridx++; constraints.fill = GridBagConstraints.NONE; this.add(jsonPathButton, constraints); constraints.gridx--; constraints.gridy++; constraints.anchor = GridBagConstraints.CENTER; this.add(JSONPathTextField.createLabelForDocumentationURI(), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy++; constraints.gridwidth = 3; this.add(new JSeparator(JSeparator.HORIZONTAL), constraints); constraints.gridwidth = 1; constraints.gridx = 0; constraints.gridy++; constraints.anchor = GridBagConstraints.WEST; this.add(portDepthLabel, constraints); constraints.gridx++; constraints.anchor = GridBagConstraints.EAST; constraints.gridwidth = 2; this.add(portDepthInputPane, constraints); constraints.gridwidth = 1; }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.simulator.viewcomponent.DataGenerationPanel.java
/** * Inits the components.//from ww w . j a v a 2 s . c o m */ public synchronized void initComponents() { while (activeFrame == null) { if (applicationService != null && applicationService.getFrameView() != null) { activeFrame = applicationService.getFrameView().getActiveFrame(); } } JPanel runPanel = new JPanel(); runPanel.setLayout(new BoxLayout(runPanel, BoxLayout.LINE_AXIS)); runPanel.setBorder(BorderFactory.createEmptyBorder(paddingSize, paddingSize, paddingSize, paddingSize)); JXLabel label = new JXLabel(); label.setLineWrap(true); label.setText( "<html>This panel allows the creation of clinically plausible data based on a query specification. " + "Please note that you <b>must</b> always specify a data generation source. " + "The rest of the parameters can be left in their default state. When you've configured the parameters " + "click the 'Generate data' button.</html>"); runPanel.add(label); runPanel.add(new JSeparator(SwingConstants.VERTICAL)); runPanel.add(Box.createHorizontalStrut(paddingSize)); JideButton runButton = new JideButton(new GenerateDataAction(applicationService, queryService, dataGenerationEngine, propertyChangeTrackerService)); runButton.setButtonStyle(ButtonStyle.HYPERLINK_STYLE); runPanel.add(runButton); runButton.setIcon(new ImageIcon(DataGenerationPanel.class.getResource("resources/linuxconf.png"))); runPanel.add(Box.createHorizontalStrut(paddingSize)); // create radio buttons for choosing source JRadioButton queryButton = new JRadioButton("Active Query"); queryButton.setSelected(true); queryButton.addActionListener(this); queryButton.setActionCommand("activeQuery"); JRadioButton fileButton = new JRadioButton("File"); fileButton.addActionListener(this); fileButton.setActionCommand("file"); JRadioButton folderButton = new JRadioButton("Folder"); folderButton.addActionListener(this); folderButton.setActionCommand("folder"); ButtonGroup bg = new ButtonGroup(); bg.add(queryButton); bg.add(fileButton); bg.add(folderButton); JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.LINE_AXIS)); // buttonsPanel.add(new JLabel("Select data generation source")); buttonsPanel.setBorder(BorderFactory.createTitledBorder("Select data generation source")); buttonsPanel.add(Box.createHorizontalStrut(paddingSize)); buttonsPanel.add(queryButton); buttonsPanel.add(Box.createHorizontalStrut(paddingSize)); buttonsPanel.add(fileButton); buttonsPanel.add(Box.createHorizontalStrut(paddingSize)); buttonsPanel.add(folderButton); locationField = new JTextField(100); JButton loadQueryButton = new JButton("Browse"); loadQueryButton.addActionListener(this); loadQueryButton.setActionCommand("load"); locationPanel = new JPanel(); locationPanel.setLayout(new BoxLayout(locationPanel, BoxLayout.LINE_AXIS)); locationPanel.add(new JLabel("Load file from")); locationPanel.add(Box.createHorizontalStrut(paddingSize)); locationPanel.add(locationField); locationPanel.add(Box.createHorizontalStrut(paddingSize)); locationPanel.add(loadQueryButton); JPanel lhsPanel = new JPanel(new GridLayout(0, 2)); JPanel rhsPanel = new JPanel(new GridLayout(0, 2)); lhsPanel.add(new JLabel("Max number of patients to generate")); SpinnerNumberModel model = new SpinnerNumberModel(initialPatientsNumber, 1, 1000000, 1); ptNumberSpinner = new JSpinner(model); ptNumberSpinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { // get value currently selected in spinner and set in engine dataGenerationEngine.setMaxPatientNumber(Long.parseLong(ptNumberSpinner.getValue().toString())); // Object value = ptNumberSpinner.getValue(); // if(value instanceof Double) // { // Double d = (Double) ptNumberSpinner.getValue(); // dataGenerationEngine.setMaxPatientNumber(d.longValue()); // } // else // { // dataGenerationEngine.setMaxPatientNumber(Long.parseLong(ptNumberSpinner.getValue().toString())); // } logger.debug("ptNumberSpinner.getValue().getClass() = " + ptNumberSpinner.getValue().getClass()); logger.debug("Max pt number in engine set to : " + dataGenerationEngine.getMaxPatientNumber()); } }); lhsPanel.add(ptNumberSpinner); lhsPanel.add(new JLabel("Min age of patients to generate")); SpinnerNumberModel ageModel = new SpinnerNumberModel(initialMinimumAge, 1, 120, 1); minAgeSpinner = new JSpinner(ageModel); minAgeSpinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { // set min pt age to current value dataGenerationEngine.setMinPatientAgeInYears(Integer.parseInt(minAgeSpinner.getValue().toString())); logger.debug("Value of engine.getMinPatientAgeInYears() : " + dataGenerationEngine.getMinPatientAgeInYears()); } }); lhsPanel.add(minAgeSpinner); lhsPanel.add(new JLabel("Data generation strategy")); generationStrategyBox = new JComboBox(DataGenerationEngine.DataGenerationStrategy.values()); generationStrategyBox.setSelectedItem(DataGenerationEngine.DataGenerationStrategy.ADD_IF_NOT_EXISTS); generationStrategyBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dataGenerationEngine.setDataGenerationStrategy( (DataGenerationEngine.DataGenerationStrategy) generationStrategyBox.getSelectedItem()); } }); lhsPanel.add(generationStrategyBox); includeExcludedTermsBox = new JCheckBox(new AbstractAction("Include Excluded terms in data") { public void actionPerformed(ActionEvent arg0) { dataGenerationEngine.setIncludeExcludedTerms(includeExcludedTermsBox.isSelected()); logger.debug("dataGenerationEngine.isIncludeExcludedTerms() = " + dataGenerationEngine.isIncludeExcludedTerms()); } }); rhsPanel.add(includeExcludedTermsBox); randomiseNumericalValuesBox = new JCheckBox(new AbstractAction("Randomise Numerical values in data") { public void actionPerformed(ActionEvent arg0) { dataGenerationEngine.setRandomiseNumericalValues(randomiseNumericalValuesBox.isSelected()); logger.debug("dataGenerationEngine.isRandomiseNumericalValues() = " + dataGenerationEngine.isRandomiseNumericalValues()); } }); rhsPanel.add(randomiseNumericalValuesBox); refineQualifiersCheckBox = new JCheckBox(new AbstractAction("Refine Qualifiers in expression") { public void actionPerformed(ActionEvent e) { dataGenerationEngine.setRefineQualifiers(refineQualifiersCheckBox.isSelected()); logger.debug( "dataGenerationEngine.isRefineQualifiers() = " + dataGenerationEngine.isRefineQualifiers()); } }); rhsPanel.add(refineQualifiersCheckBox); includePreCoordinatedDataCheckBox = new JCheckBox( new AbstractAction("Include pre-coordinated expressions") { public void actionPerformed(ActionEvent e) { dataGenerationEngine .setIncludePrecoordinatedData(includePreCoordinatedDataCheckBox.isSelected()); logger.debug("dataGenerationEngine.isIncludePrecoordinatedData() = " + dataGenerationEngine.isIncludePrecoordinatedData()); } }); rhsPanel.add(includePreCoordinatedDataCheckBox); rhsPanel.add(new JLabel(" ")); /* * create panel for parametrising engine */ JPanel parametrisationPanel = new JPanel(); parametrisationPanel.setLayout(new GridLayout(0, 2)); parametrisationPanel.setBorder(BorderFactory.createTitledBorder("Engine Parameters")); // add panels to parametrisation panel parametrisationPanel.add(lhsPanel); parametrisationPanel.add(rhsPanel); JPanel topPanel = new JPanel(); topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.LINE_AXIS)); topPanel.add(runPanel); topPanel.add(new JSeparator(SwingConstants.VERTICAL)); topPanel.add(buttonsPanel); // add all panels to this component setLayout(new BorderLayout()); add(topPanel, BorderLayout.NORTH); add(parametrisationPanel, BorderLayout.CENTER); // initialise values populateFields(dataGenerationEngine); }
From source file:volker.streaming.music.gui.FormatPanel.java
private void initComponents() { formatLabel = new JLabel("How should your track info be displayed:"); formatArea = new JTextArea(config.getFormat()); formatLighter = new DefaultHighlighter(); // TODO allow configuration of this color formatPainter = new DefaultHighlighter.DefaultHighlightPainter(new Color(200, 200, 255)); formatArea.setHighlighter(formatLighter); formatArea.getDocument().addDocumentListener(new DocumentListener() { @Override/* ww w. ja v a 2 s. com*/ public void removeUpdate(DocumentEvent e) { formatUpdated(); } @Override public void insertUpdate(DocumentEvent e) { formatUpdated(); } @Override public void changedUpdate(DocumentEvent e) { formatUpdated(); } }); ImageIcon infoIcon = null; try { InputStream is = getClass().getResourceAsStream("info.png"); if (is == null) { LOG.error("Couldn't find the info image."); } else { infoIcon = new ImageIcon(ImageIO.read(is)); is.close(); } } catch (IOException e1) { LOG.error("Couldn't find the info image.", e1); } if (infoIcon == null) { formatInfoButton = new JButton("?"); } else { formatInfoButton = new JButton(infoIcon); formatInfoButton.setBorder(BorderFactory.createEmptyBorder()); } formatInfoButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showFormatHelp(); } }); templateLabel = new JLabel("Your template:"); tagLabel = new JLabel("Available tags:"); tagList = new JList<String>(new AbstractListModel<String>() { private static final long serialVersionUID = -8886588605378873151L; @Override public int getSize() { return properTags.size(); } @Override public String getElementAt(int index) { return properTags.get(index); } }); tagScrollPane = new JScrollPane(tagList); previewLabel = new JLabel("Preview:"); previewField = new JTextField(); previewField.setEditable(false); previewField.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1)); previewField.setBackground(new Color(255, 255, 150)); formatUpdated(); highlightTags(); nullMessageLabel = new JLabel("Message to display when no song is found:"); nullMessageField = new JTextField(config.getNoTrackMessage() == null ? "" : config.getNoTrackMessage()); nullMessageField.getDocument().addDocumentListener(new DocumentListener() { public void action() { config.setNoTrackMessage(nullMessageField.getText()); } @Override public void removeUpdate(DocumentEvent e) { action(); } @Override public void insertUpdate(DocumentEvent e) { action(); } @Override public void changedUpdate(DocumentEvent e) { action(); } }); hline = new JSeparator(SwingConstants.HORIZONTAL); fileLabel = new JLabel("Location of text file:"); fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileField = new JTextField(15); if (config.getOutputFile() != null) { fileField.setText(config.getOutputFile().getAbsolutePath()); } fileField.getDocument().addDocumentListener(new DocumentListener() { public void action() { config.setOutputFile(new File(fileField.getText())); } @Override public void removeUpdate(DocumentEvent e) { action(); } @Override public void insertUpdate(DocumentEvent e) { action(); } @Override public void changedUpdate(DocumentEvent e) { action(); } }); fileButton = new JButton("Browse"); fileButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { browseFile(); } }); }
From source file:xtrememp.XtremeMP.java
protected void createPanels() { JPanel framePanel = new JPanel(new MigLayout("fill")); mainPanel = new JPanel(new CardLayout()); playlistManager = new PlaylistManager(this); visualizationManager = new VisualizationManager(audioPlayer.getDSS()); if (Settings.getLastView().equals(Utilities.VISUALIZATION_PANEL)) { visualizationManager.setDssEnabled(true); mainPanel.add(visualizationManager, Utilities.VISUALIZATION_PANEL); mainPanel.add(playlistManager, Utilities.PLAYLIST_MANAGER); visualizationMenuItem.setSelected(true); } else {// w w w.j a v a 2s .c o m mainPanel.add(playlistManager, Utilities.PLAYLIST_MANAGER); mainPanel.add(visualizationManager, Utilities.VISUALIZATION_PANEL); playlistManagerMenuItem.setSelected(true); } framePanel.add(mainPanel, "grow"); JPanel southPanel = new JPanel(new MigLayout("fill", "[center]")); SubstanceLookAndFeel.setDecorationType(southPanel, DecorationAreaType.TOOLBAR); seekSlider = new SeekSlider(this); seekSlider.setEnabled(false); southPanel.add(seekSlider, "north, gap 4 4 1 0"); controlPanel = new JPanel(new MigLayout("gap 0, ins 0", "[center]")); controlPanel.setOpaque(false); stopButton = new StopButton(); stopButton.setEnabled(false); stopButton.addActionListener(this); controlPanel.add(stopButton); previousButton = new PreviousButton(); previousButton.setEnabled(false); previousButton.addActionListener(this); controlPanel.add(previousButton); playPauseButton = new PlayPauseButton(); playPauseButton.addActionListener(this); controlPanel.add(playPauseButton, "height pref!"); nextButton = new NextButton(); nextButton.setEnabled(false); nextButton.addActionListener(this); controlPanel.add(nextButton); volumeButton = new VolumeButton(Utilities.MIN_GAIN, Utilities.MAX_GAIN, Settings.getGain(), Settings.isMuted()); volumeButton.addMouseWheelListener((MouseWheelEvent e) -> { try { int volumeValue = volumeSlider.getValue() - 5 * e.getWheelRotation(); int volumeMin = volumeSlider.getMinimum(); int volumeMax = volumeSlider.getMaximum(); if (volumeValue < volumeMin) { volumeValue = volumeMin; } else if (volumeValue > volumeMax) { volumeValue = volumeMax; } volumeButton.setVolumeIcon(volumeValue); volumeSlider.setValue(volumeValue); audioPlayer.setGain(volumeValue / 100.0F); Settings.setGain(volumeValue); } catch (PlayerException ex) { logger.debug(ex.getMessage(), ex); } }); JPopupMenu volumePopupMenu = volumeButton.getPopupMenu(); volumeSlider = new JSlider(JSlider.VERTICAL, Utilities.MIN_GAIN, Utilities.MAX_GAIN, Settings.getGain()); volumeSlider.setMajorTickSpacing(25); volumeSlider.setMinorTickSpacing(5); volumeSlider.setPaintTicks(true); volumeSlider.setPaintLabels(true); volumeSlider.addChangeListener((ChangeEvent e) -> { if (volumeSlider.getValueIsAdjusting()) { try { int volumeValue = volumeSlider.getValue(); volumeButton.setVolumeIcon(volumeValue); audioPlayer.setGain(volumeValue / 100.0F); Settings.setGain(volumeValue); } catch (PlayerException ex) { logger.debug(ex.getMessage(), ex); } } }); volumeSlider.setEnabled(!Settings.isMuted()); JPanel volumePanel = new JPanel(new MigLayout("fill")); JLabel volumeLabel = new JLabel(tr("MainFrame.Menu.Player.Volume"), JLabel.CENTER); volumeLabel.setFont(volumeLabel.getFont().deriveFont(Font.BOLD)); volumePanel.add(volumeLabel, "north"); volumePanel.add(volumeSlider); JCheckBox muteCheckBox = new JCheckBox(tr("MainFrame.Menu.Player.Mute")); muteCheckBox.setSelected(Settings.isMuted()); muteCheckBox.addItemListener((ItemEvent e) -> { try { if (e.getStateChange() == ItemEvent.SELECTED) { volumeSlider.setEnabled(false); volumeButton.setVolumeMutedIcon(); audioPlayer.setMuted(true); Settings.setMuted(true); } else { volumeSlider.setEnabled(true); volumeButton.setVolumeIcon(Settings.getGain()); audioPlayer.setMuted(false); Settings.setMuted(false); } } catch (PlayerException ex) { logger.debug(ex.getMessage(), ex); } }); volumePanel.add(muteCheckBox, "south"); volumePopupMenu.add(volumePanel); controlPanel.add(volumeButton); southPanel.add(controlPanel, "gap 0 0 2 5"); JPanel statusBar = new JPanel(new MigLayout("ins 2 0 2 0")); SubstanceLookAndFeel.setDecorationType(statusBar, DecorationAreaType.FOOTER); timeLabel = new JLabel(Utilities.ZERO_TIMER); timeLabel.setFont(timeLabel.getFont().deriveFont(Font.BOLD)); statusBar.add(timeLabel, "gap 6 6 0 0, west"); statusBar.add(new JSeparator(SwingConstants.VERTICAL), "hmin 16"); statusLabel = new JLabel(); statusBar.add(statusLabel, "gap 0 2 0 0, wmin 0, push"); statusBar.add(new JSeparator(SwingConstants.VERTICAL), "hmin 16"); playModeLabel = new JLabel(); playModeLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { Playlist.PlayMode[] playModes = Playlist.PlayMode.values(); Playlist.PlayMode playMode = playlist.getPlayMode(); int ordinal = playMode.ordinal(); playlist.setPlayMode(playModes[(ordinal == playModes.length - 1) ? 0 : ordinal + 1]); } }); statusBar.add(playModeLabel, "east, gap 2 2 2 2, width 18!, height 18!"); southPanel.add(statusBar, "south"); framePanel.add(southPanel, "south"); mainFrame.setContentPane(framePanel); }