List of usage examples for javax.swing ButtonGroup ButtonGroup
public ButtonGroup()
ButtonGroup
. From source file:org.rdv.ui.MainPanel.java
private void initMenuBar() { Application application = RDV.getInstance(); ApplicationContext context = application.getContext(); ResourceMap resourceMap = context.getResourceMap(); String platform = resourceMap.getString("platform"); boolean isMac = (platform != null && platform.equals("osx")); ActionFactory actionFactory = ActionFactory.getInstance(); Actions actions = Actions.getInstance(); ActionMap actionMap = context.getActionMap(actions); menuBar = new JMenuBar(); JMenuItem menuItem;/*from w ww . j a va2 s . c o m*/ JMenu fileMenu = new JMenu(fileAction); menuItem = new JMenuItem(connectAction); fileMenu.add(menuItem); menuItem = new JMenuItem(disconnectAction); fileMenu.add(menuItem); fileMenu.addSeparator(); menuItem = new JMenuItem(loginAction); fileMenu.add(menuItem); menuItem = new JMenuItem(logoutAction); fileMenu.add(menuItem); fileMenu.addMenuListener(new MenuListener() { public void menuCanceled(MenuEvent arg0) { } public void menuDeselected(MenuEvent arg0) { } public void menuSelected(MenuEvent arg0) { if (AuthenticationManager.getInstance().getAuthentication() == null) { loginAction.setEnabled(true); logoutAction.setEnabled(false); } else { loginAction.setEnabled(false); logoutAction.setEnabled(true); } } }); fileMenu.addSeparator(); menuItem = new JMenuItem(loadAction); fileMenu.add(menuItem); menuItem = new JMenuItem(saveAction); fileMenu.add(menuItem); fileMenu.addSeparator(); fileMenu.add(new JMenuItem(actionMap.get("addLocalChannel"))); fileMenu.addSeparator(); JMenu importSubMenu = new JMenu(importAction); menuItem = new JMenuItem(actionFactory.getDataImportAction()); importSubMenu.add(menuItem); menuItem = new JMenuItem(actionFactory.getOpenSeesDataImportAction()); importSubMenu.add(menuItem); importSubMenu.add(new JMenuItem(actionMap.get("importJPEGs"))); fileMenu.add(importSubMenu); JMenu exportSubMenu = new JMenu(exportAction); menuItem = new JMenuItem(actionFactory.getDataExportAction()); exportSubMenu.add(menuItem); menuItem = new JMenuItem(exportVideoAction); exportSubMenu.add(menuItem); fileMenu.add(exportSubMenu); fileMenu.addSeparator(); menuItem = new DataViewerCheckBoxMenuItem(actionFactory.getOfflineAction()); fileMenu.add(menuItem); if (!isMac) { menuItem = new JMenuItem(exitAction); fileMenu.add(menuItem); } menuBar.add(fileMenu); JMenu controlMenu = new JMenu(controlAction); menuItem = new SelectableCheckBoxMenuItem(realTimeAction); controlMenu.add(menuItem); menuItem = new SelectableCheckBoxMenuItem(playAction); controlMenu.add(menuItem); menuItem = new SelectableCheckBoxMenuItem(pauseAction); controlMenu.add(menuItem); controlMenu.addMenuListener(new MenuListener() { public void menuCanceled(MenuEvent arg0) { } public void menuDeselected(MenuEvent arg0) { } public void menuSelected(MenuEvent arg0) { int state = rbnb.getState(); realTimeAction.setSelected(state == Player.STATE_MONITORING); playAction.setSelected(state == Player.STATE_PLAYING); pauseAction.setSelected(state == Player.STATE_STOPPED); } }); controlMenu.addSeparator(); menuItem = new JMenuItem(beginningAction); controlMenu.add(menuItem); menuItem = new JMenuItem(endAction); controlMenu.add(menuItem); menuItem = new JMenuItem(gotoTimeAction); controlMenu.add(menuItem); menuBar.add(controlMenu); controlMenu.addSeparator(); menuItem = new JMenuItem(updateChannelListAction); controlMenu.add(menuItem); controlMenu.addSeparator(); menuItem = new JCheckBoxMenuItem(dropDataAction); controlMenu.add(menuItem); JMenu viewMenu = new JMenu(viewAction); menuItem = new JCheckBoxMenuItem(showChannelListAction); menuItem.setSelected(true); viewMenu.add(menuItem); menuItem = new JCheckBoxMenuItem(showMetadataPanelAction); menuItem.setSelected(true); viewMenu.add(menuItem); menuItem = new JCheckBoxMenuItem(showControlPanelAction); menuItem.setSelected(true); viewMenu.add(menuItem); menuItem = new JCheckBoxMenuItem(showAudioPlayerPanelAction); menuItem.setSelected(false); viewMenu.add(menuItem); menuItem = new JCheckBoxMenuItem(showMarkerPanelAction); menuItem.setSelected(true); viewMenu.add(menuItem); viewMenu.addSeparator(); menuItem = new JCheckBoxMenuItem(showHiddenChannelsAction); menuItem.setSelected(false); viewMenu.add(menuItem); menuItem = new JCheckBoxMenuItem(hideEmptyTimeAction); menuItem.setSelected(false); viewMenu.add(menuItem); viewMenu.addSeparator(); menuItem = new JCheckBoxMenuItem(fullScreenAction); menuItem.setSelected(false); viewMenu.add(menuItem); menuBar.add(viewMenu); JMenu windowMenu = new JMenu(windowAction); List<Extension> extensions = dataPanelManager.getExtensions(); for (final Extension extension : extensions) { Action action = new DataViewerAction("Add " + extension.getName(), "", KeyEvent.VK_J) { /** serialization version identifier */ private static final long serialVersionUID = 36998228704476723L; public void actionPerformed(ActionEvent ae) { try { dataPanelManager.createDataPanel(extension); } catch (Exception e) { log.error("Unable to open data panel provided by extension " + extension.getName() + " (" + extension.getID() + ")."); e.printStackTrace(); } } }; menuItem = new JMenuItem(action); windowMenu.add(menuItem); } windowMenu.addSeparator(); menuItem = new JMenuItem(closeAllDataPanelsAction); windowMenu.add(menuItem); windowMenu.addSeparator(); JMenu dataPanelSubMenu = new JMenu(dataPanelAction); ButtonGroup dataPanelLayoutGroup = new ButtonGroup(); menuItem = new JRadioButtonMenuItem(dataPanelHorizontalLayoutAction); dataPanelSubMenu.add(menuItem); dataPanelLayoutGroup.add(menuItem); menuItem = new JRadioButtonMenuItem(dataPanelVerticalLayoutAction); menuItem.setSelected(true); dataPanelSubMenu.add(menuItem); dataPanelLayoutGroup.add(menuItem); windowMenu.add(dataPanelSubMenu); menuBar.add(windowMenu); JMenu helpMenu = new JMenu(helpAction); menuItem = new JMenuItem(usersGuideAction); helpMenu.add(menuItem); menuItem = new JMenuItem(supportAction); helpMenu.add(menuItem); menuItem = new JMenuItem(releaseNotesAction); helpMenu.add(menuItem); if (!isMac) { helpMenu.addSeparator(); menuItem = new JMenuItem(aboutAction); helpMenu.add(menuItem); } menuBar.add(helpMenu); menuBar.add(Box.createHorizontalGlue()); throbberStop = DataViewer.getIcon("icons/throbber.png"); throbberAnim = DataViewer.getIcon("icons/throbber_anim.gif"); throbber = new JLabel(throbberStop); throbber.setBorder(new EmptyBorder(0, 0, 0, 4)); menuBar.add(throbber, BorderLayout.EAST); if (isMac) { registerMacOSXEvents(); } frame.setJMenuBar(menuBar); }
From source file:org.rdv.viz.image.HighResImageViz.java
public void buildPopupMenu(JPopupMenu menu, MouseEvent e) { super.buildPopupMenu(menu, e); ActionListener setTimerangeAction = new ActionListener() { public void actionPerformed(ActionEvent ae) { double newScale = Double.parseDouble(ae.getActionCommand()); setLocalTimescale(newScale); }// ww w . ja v a 2 s .c o m }; // regenerate new menu JMenu timeRangeMenu = new JMenu("Set Timerange"); ButtonGroup timeRangeGroup = new ButtonGroup(); JRadioButtonMenuItem range = new JRadioButtonMenuItem(TimeScale.TIME_SCALE_UNDEFINED_DESC); range.setActionCommand(String.valueOf(TimeScale.TIME_SCALE_UNDEFINED)); range.addActionListener(setTimerangeAction); timeRangeGroup.add(range); timeRangeMenu.add(range); if (localTimeScale_ == TimeScale.TIME_SCALE_UNDEFINED) range.setSelected(true); Double timeScales[] = TimeScale.getGlobalTimeScales(); for (int i = 0; i < timeScales.length; i++) { range = new JRadioButtonMenuItem(DataViewer.formatSeconds(timeScales[i])); range.setActionCommand(String.valueOf(timeScales[i])); range.addActionListener(setTimerangeAction); timeRangeGroup.add(range); timeRangeMenu.add(range); if (localTimeScale_ == timeScales[i]) range.setSelected(true); } menu.add(timeRangeMenu); menu.addSeparator(); // create a popup to copy an image to the clipboard final JMenuItem copyImageMenuItem = new JMenuItem("Copy"); copyImageMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { copyImage(); } }); menu.add(copyImageMenuItem); menu.addSeparator(); // create a popup to save an image final JMenuItem saveImageMenuItem = new JMenuItem("Save as..."); saveImageMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { saveImage(); } }); menu.add(saveImageMenuItem); menu.addSeparator(); // create a popup to copy an image to the clipboard final JMenuItem printImageMenuItem = new JMenuItem("Print..."); printImageMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { printImage(); } }); menu.add(printImageMenuItem); menu.addSeparator(); final JMenuItem zoomInMenuItem = new JMenuItem("Zoom in"); zoomInMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { imagePanel.zoomIn(); } }); menu.add(zoomInMenuItem); final JMenuItem zoomOutMenuItem = new JMenuItem("Zoom out"); zoomOutMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { imagePanel.zoomOut(); } }); menu.add(zoomOutMenuItem); final JSeparator zoomMenuSeparator = new JPopupMenu.Separator(); menu.add(zoomMenuSeparator); final JCheckBoxMenuItem autoScaleMenuItem = new JCheckBoxMenuItem("Auto scale", imagePanel.isAutoScaling()); autoScaleMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { setAutoScale(autoScaleMenuItem.isSelected()); } }); menu.add(autoScaleMenuItem); final JMenuItem resetScaleMenuItem = new JMenuItem("Reset scale"); resetScaleMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { imagePanel.setScale(1); } }); menu.add(resetScaleMenuItem); final JCheckBoxMenuItem showNavigationImageMenuItem = new JCheckBoxMenuItem("Show navigation image", imagePanel.isNavigationImageEnabled()); showNavigationImageMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setShowNavigationImage(showNavigationImageMenuItem.isSelected()); } }); menu.add(showNavigationImageMenuItem); //menu.addSeparator(); final JCheckBoxMenuItem useThumbnailImageMenuItem = new JCheckBoxMenuItem("Use thumbnail image", useThumbnailImage); useThumbnailImageMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setUseThumbnailImage(useThumbnailImageMenuItem.isSelected()); } }); menu.add(useThumbnailImageMenuItem); boolean hasImage = displayedImageData != null; saveImageMenuItem.setEnabled(hasImage); copyImageMenuItem.setEnabled(hasImage); printImageMenuItem.setEnabled(hasImage); boolean enableZoom = hasImage; zoomInMenuItem.setEnabled(enableZoom); zoomInMenuItem.setVisible(true); zoomOutMenuItem.setEnabled(enableZoom); zoomOutMenuItem.setVisible(true); zoomMenuSeparator.setVisible(true); autoScaleMenuItem.setVisible(true); resetScaleMenuItem.setVisible(true); showNavigationImageMenuItem.setVisible(true); useThumbnailImageMenuItem.setSelected(useThumbnailImage); useThumbnailImageMenuItem.setVisible(imageHasThumbnail()); }
From source file:org.rdv.viz.image.ImageViz.java
private void initPopupMenu() { final JPopupMenu popupMenu = new JPopupMenu(); // create a popup to copy an image to the clipboard final JMenuItem copyImageMenuItem = new JMenuItem("Copy"); copyImageMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { copyImage();/* w w w . j a v a 2s . co m*/ } }); popupMenu.add(copyImageMenuItem); popupMenu.addSeparator(); // create a popup to save an image final JMenuItem saveImageMenuItem = new JMenuItem("Save as..."); saveImageMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { saveImage(); } }); popupMenu.add(saveImageMenuItem); popupMenu.addSeparator(); // create a popup to copy an image to the clipboard final JMenuItem printImageMenuItem = new JMenuItem("Print..."); printImageMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { printImage(); } }); popupMenu.add(printImageMenuItem); popupMenu.addSeparator(); final JMenuItem zoomInMenuItem = new JMenuItem("Zoom in"); zoomInMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { imagePanel.zoomIn(); } }); popupMenu.add(zoomInMenuItem); final JMenuItem zoomOutMenuItem = new JMenuItem("Zoom out"); zoomOutMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { imagePanel.zoomOut(); } }); popupMenu.add(zoomOutMenuItem); final JSeparator zoomMenuSeparator = new JPopupMenu.Separator(); popupMenu.add(zoomMenuSeparator); autoScaleMenuItem = new JCheckBoxMenuItem("Auto scale", true); autoScaleMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { setAutoScale(autoScaleMenuItem.isSelected()); } }); popupMenu.add(autoScaleMenuItem); final JMenuItem resetScaleMenuItem = new JMenuItem("Reset scale"); resetScaleMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { imagePanel.setScale(1); } }); popupMenu.add(resetScaleMenuItem); showNavigationImageMenuItem = new JCheckBoxMenuItem("Show navigation image", imagePanel.isNavigationImageEnabled()); showNavigationImageMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setShowNavigationImage(showNavigationImageMenuItem.isSelected()); } }); popupMenu.add(showNavigationImageMenuItem); final JMenu maximumFilmstripImagesMenu = new JMenu("Maximum number of images"); maximumFilmstripImagesButtonGroup = new ButtonGroup(); for (final int maximumFilmstripImagesValue : MAXIMUM_FILMSTRIP_IMAGES_VALUES) { boolean selected = filmstripPanel.getMaximumImages() == maximumFilmstripImagesValue; JMenuItem maximumFilmStripImagesMenuItem = new JRadioButtonMenuItem( Integer.toString(maximumFilmstripImagesValue), selected); maximumFilmStripImagesMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { filmstripPanel.setMaximumImages(maximumFilmstripImagesValue); } }); maximumFilmstripImagesButtonGroup.add(maximumFilmStripImagesMenuItem); maximumFilmstripImagesMenu.add(maximumFilmStripImagesMenuItem); } popupMenu.add(maximumFilmstripImagesMenu); popupMenu.addSeparator(); final JCheckBoxMenuItem showAsFilmstripMenuItem = new JCheckBoxMenuItem("Show as filmstrip", filmstripMode); showAsFilmstripMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { boolean filmstripMode = showAsFilmstripMenuItem.isSelected(); setFilmstripMode(filmstripMode); } }); popupMenu.add(showAsFilmstripMenuItem); final JCheckBoxMenuItem useThumbnailImageMenuItem = new JCheckBoxMenuItem("Use thumbnail image", useThumbnailImage); useThumbnailImageMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setUseThumbnailImage(useThumbnailImageMenuItem.isSelected()); } }); popupMenu.add(useThumbnailImageMenuItem); hideRoboticControlsMenuItem = new JCheckBoxMenuItem("Disable robotic controls", false); hideRoboticControlsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { setRoboticControls(); } }); popupMenu.add(hideRoboticControlsMenuItem); // enable the save image popup if an image is being displayed popupMenu.addPopupMenuListener(new PopupMenuListener() { public void popupMenuWillBecomeVisible(PopupMenuEvent arg0) { boolean hasImage = displayedImageData != null; saveImageMenuItem.setEnabled(hasImage); copyImageMenuItem.setEnabled(hasImage); printImageMenuItem.setEnabled(hasImage); boolean enableZoom = hasImage && !filmstripMode; zoomInMenuItem.setEnabled(enableZoom); zoomInMenuItem.setVisible(!filmstripMode); zoomOutMenuItem.setEnabled(enableZoom); zoomOutMenuItem.setVisible(!filmstripMode); zoomMenuSeparator.setVisible(!filmstripMode); autoScaleMenuItem.setVisible(!filmstripMode); resetScaleMenuItem.setVisible(!filmstripMode); showNavigationImageMenuItem.setVisible(!filmstripMode); maximumFilmstripImagesMenu.setVisible(filmstripMode); showAsFilmstripMenuItem.setSelected(filmstripMode); useThumbnailImageMenuItem.setSelected(useThumbnailImage); useThumbnailImageMenuItem.setVisible(imageHasThumbnail()); hideRoboticControlsMenuItem.setVisible(flexTPSStream != null); } public void popupMenuWillBecomeInvisible(PopupMenuEvent arg0) { } public void popupMenuCanceled(PopupMenuEvent arg0) { } }); // set component popup and mouselistener to trigger it panel.setComponentPopupMenu(popupMenu); imagePanel.setComponentPopupMenu(popupMenu); filmstripPanel.setComponentPopupMenu(popupMenu); panel.addMouseListener(new MouseInputAdapter() { }); }
From source file:org.scify.talkandplay.gui.users.UserFormPanel.java
private void setUI() { ButtonGroup scanButtons = new ButtonGroup(); scanButtons.add(autoScanRadioButton); scanButtons.add(manualScanRadioButton); //set the titles of the form nameLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); imageLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); sensorLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); rotationSpeedLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); defaultGridSizeLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); tilesLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); nameTextField.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Color.GRAY)); nameTextField.setFont(new Font(UIConstants.mainFont, Font.ITALIC, 14)); nameTextField.setHorizontalAlignment(JTextField.CENTER); uploadImageLabel.setFont(new Font(UIConstants.mainFont, Font.BOLD, 14)); rowsTextField.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Color.GRAY)); rowsTextField.setHorizontalAlignment(JTextField.CENTER); columnsTextField.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Color.GRAY)); columnsTextField.setHorizontalAlignment(JTextField.CENTER); disableTextField(selectionSensorTextField2); disableTextField(navigationSensorTextField); enableTextField(selectionSensorTextField1); //set the text color selectionSensorTextField1.setForeground(Color.decode(UIConstants.green)); selectionSensorTextField2.setForeground(Color.decode(UIConstants.green)); navigationSensorTextField.setForeground(Color.decode(UIConstants.green)); selectionSensorTextField1.setHorizontalAlignment(JTextField.CENTER); selectionSensorTextField2.setHorizontalAlignment(JTextField.CENTER); navigationSensorTextField.setHorizontalAlignment(JTextField.CENTER); step6ExplTextArea.setEditable(false); step6ExplTextArea.setLineWrap(true); step6ExplTextArea.setWrapStyleWord(true); step6ExplTextArea.setBorder(javax.swing.BorderFactory.createEmptyBorder()); jScrollPane1.setBorder(null);// ww w. j av a 2s . co m imageCheckBox.setSelected(true); imageCheckBox.setVisible(false); }
From source file:org.squidy.designer.Designer.java
/** * Initializes menu bar.//from w ww . ja va 2 s . c o m */ private void initMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenu workspace = new JMenu("Workspace"); workspace.add(new AbstractAction("Open from...") { /* * (non-Javadoc) * * @see * java.awt.event.ActionListener#actionPerformed(java.awt.event. * ActionEvent) */ public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileHidingEnabled(true); fileChooser.setFileFilter(new FileFilter() { /* * (non-Javadoc) * * @see * javax.swing.filechooser.FileFilter#accept(java.io.File) */ @Override public boolean accept(File f) { return f.isDirectory() || f.getName().endsWith(".sdy"); } /* * (non-Javadoc) * * @see javax.swing.filechooser.FileFilter#getDescription() */ @Override public String getDescription() { return "Squidy Workspace"; } }); int option = fileChooser.showOpenDialog(Designer.this); if (option == JFileChooser.APPROVE_OPTION) { // Stop replacing workspace if currently running. if (data != null) { data.getWorkspace().stop(); } File workspaceFile = fileChooser.getSelectedFile(); if (storage instanceof LocalJAXBStorage) { ((LocalJAXBStorage) storage).setWorkspaceFile(workspaceFile); load(); } else { try { data = ModelViewHandler.getModelViewHandler().load(new FileInputStream(workspaceFile)); WorkspaceShape workspace = data.getWorkspaceShape(); workspace.setModel(data); workspace.setStorageHandler(Designer.this); workspace.initialize(); LayoutConstraint lc = workspace.getLayoutConstraint(); workspace.setScale(lc.getScale()); workspace.setOffset(lc.getX(), lc.getY()); getCanvas().getLayer().addChild(workspace); zoomToZoomedShape(data); } catch (SquidyException e1) { e1.printStackTrace(); } catch (FileNotFoundException e1) { e1.printStackTrace(); } } } } }); workspace.add(new AbstractAction("Export as...") { /* * (non-Javadoc) * * @see * java.awt.event.ActionListener#actionPerformed(java.awt.event. * ActionEvent) */ public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileHidingEnabled(true); fileChooser.setFileFilter(new FileFilter() { /* * (non-Javadoc) * * @see * javax.swing.filechooser.FileFilter#accept(java.io.File) */ @Override public boolean accept(File f) { return f.isDirectory() || f.getName().endsWith(".sdy"); } /* * (non-Javadoc) * * @see javax.swing.filechooser.FileFilter#getDescription() */ @Override public String getDescription() { return "Squidy Workspace"; } }); if (storage instanceof LocalJAXBStorage) { fileChooser.setSelectedFile(((LocalJAXBStorage) storage).getWorkspaceFile()); } int option = fileChooser.showSaveDialog(Designer.this); if (option == JFileChooser.APPROVE_OPTION) { File workspaceFile = fileChooser.getSelectedFile(); try { ModelViewHandler.getModelViewHandler().save(new FileOutputStream(workspaceFile), data); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } }); JMenu options = new JMenu("Options"); rendering.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { VisualShape.setRenderPrimitiveRect(rendering.isSelected()); data.setRenderPrimitiveRect(rendering.isSelected()); storage.store(data); repaint(); } }); options.add(rendering); JMenu storage = new JMenu("Storage"); ButtonGroup group = new ButtonGroup(); final JRadioButtonMenuItem storageLocalJAXB = new JRadioButtonMenuItem("Local JAXB"); storageLocalJAXB.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (storageLocalJAXB.isSelected()) { setStorageMode(StorageMode.FILE); } } }); storage.add(storageLocalJAXB); group.add(storageLocalJAXB); final JRadioButtonMenuItem storageBaseX = new JRadioButtonMenuItem("BaseX"); storageBaseX.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (storageBaseX.isSelected()) { setStorageMode(StorageMode.BASEX); } } }); storageBaseX.setSelected(storageType.equals(BaseXStorage.class)); storage.add(storageBaseX); group.add(storageBaseX); options.add(storage); menuBar.add(workspace); menuBar.add(options); setJMenuBar(menuBar); }
From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewer.java
private void initComponents() { setLayout(new BorderLayout()); // create button panel JPanel topPanel = new JPanel(); btnTreeView = new JRadioButton("Tree"); btnTreeView.putClientProperty("cv.cardName", TREEPANEL); btnTableView = new JRadioButton("Table"); btnTableView.putClientProperty("cv.cardName", TABLEPANEL); ActionListener btnListener = new ActionListener() { public void actionPerformed(ActionEvent e) { // show the right layout panel String v = (String) ((AbstractButton) e.getSource()).getClientProperty("cv.cardName"); if (v != null) ((CardLayout) contentPanel.getLayout()).show(contentPanel, v); }/*from w w w. jav a2 s . c o m*/ }; btnTableView.addActionListener(btnListener); btnTreeView.addActionListener(btnListener); // connect buttons ButtonGroup group = new ButtonGroup(); group.add(btnTreeView); group.add(btnTableView); topPanel.setLayout(new MigLayout("", "[64px][55px][62px][grow]", "[][23px]")); lblViewAllThe = new JLabel( "<html>View all the component series that combine to create the current series. Series can be viewed as:"); topPanel.add(lblViewAllThe, "cell 0 0 4 1"); JRadioButton btnTree2View = new JRadioButton("Flow chart"); btnTree2View.putClientProperty("cv.cardName", TREE2PANEL); btnTree2View.addActionListener(btnListener); group.add(btnTree2View); topPanel.add(btnTree2View, "cell 0 1,alignx left,aligny center"); topPanel.add(btnTreeView, "cell 1 1,alignx left,aligny center"); topPanel.add(btnTableView, "cell 2 1,alignx left,aligny center"); topPanel.setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8)); add(topPanel, BorderLayout.NORTH); // create status bar JPanel status = new JPanel(); status.setLayout(new BoxLayout(status, BoxLayout.X_AXIS)); txtStatus = new JLabel(""); pbStatus = new JProgressBar(); pbStatus.setVisible(false); status.add(txtStatus); status.add(Box.createHorizontalStrut(8)); status.add(pbStatus); status.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); add(status, BorderLayout.SOUTH); contentPanel = new JPanel(new CardLayout()); add(contentPanel, BorderLayout.CENTER); tablePanel = new JPanel(new BorderLayout()); setupTable(); tablePanel.add(new JScrollPane(table), BorderLayout.CENTER); treePanel = new JPanel(new BorderLayout()); setupTree(); treePanel.add(new JScrollPane(tree), BorderLayout.CENTER); tree2Panel = new JPanel(new BorderLayout()); setupTreeGUI(); contentPanel.add(tablePanel, TABLEPANEL); contentPanel.add(treePanel, TREEPANEL); contentPanel.add(tree2Panel, TREE2PANEL); }
From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewerOld.java
private void initComponents() { JLabel label;/*from w w w . j a v a 2s. co m*/ setLayout(new BorderLayout()); // create button panel JPanel topPanel = new JPanel(); label = new JLabel("View as: "); btnTreeView = new JRadioButton("tree"); btnTreeView.putClientProperty("cv.cardName", TREEPANEL); btnTableView = new JRadioButton("table"); btnTableView.putClientProperty("cv.cardName", TABLEPANEL); ActionListener btnListener = new ActionListener() { public void actionPerformed(ActionEvent e) { // show the right layout panel String v = (String) ((AbstractButton) e.getSource()).getClientProperty("cv.cardName"); if (v != null) ((CardLayout) contentPanel.getLayout()).show(contentPanel, v); } }; btnTableView.addActionListener(btnListener); btnTreeView.addActionListener(btnListener); // connect buttons ButtonGroup group = new ButtonGroup(); group.add(btnTreeView); group.add(btnTableView); topPanel.setLayout(new MigLayout("", "[64px][55px][62px][63px][][]", "[23px]")); // add it all to a panel topPanel.add(label, "cell 0 0,alignx left,aligny center"); topPanel.add(btnTreeView, "cell 1 0,alignx left,aligny center"); topPanel.add(btnTableView, "cell 2 0,alignx left,aligny center"); topPanel.setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8)); add(topPanel, BorderLayout.NORTH); JButton btnOrder = new JButton("Order"); btnOrder.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { } }); topPanel.add(btnOrder, "cell 5 0"); // create status bar JPanel status = new JPanel(); status.setLayout(new BoxLayout(status, BoxLayout.X_AXIS)); txtStatus = new JLabel(""); pbStatus = new JProgressBar(); pbStatus.setVisible(false); status.add(txtStatus); status.add(Box.createHorizontalStrut(8)); status.add(pbStatus); status.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); add(status, BorderLayout.SOUTH); contentPanel = new JPanel(new CardLayout()); add(contentPanel, BorderLayout.CENTER); tablePanel = new JPanel(new BorderLayout()); setupTable(); tablePanel.add(new JScrollPane(table), BorderLayout.CENTER); treePanel = new JPanel(new BorderLayout()); setupTree(); treePanel.add(new JScrollPane(tree), BorderLayout.CENTER); tree2Panel = new JPanel(new BorderLayout()); createTree(); //setupTreeGUI(); contentPanel.add(tablePanel, TABLEPANEL); contentPanel.add(treePanel, TREEPANEL); contentPanel.add(tree2Panel, TREE2PANEL); }
From source file:org.tinymediamanager.ui.tvshows.settings.TvShowScraperSettingsPanel.java
/** * Instantiates a new movie scraper settings panel. *//*from ww w . j a v a 2 s.com*/ public TvShowScraperSettingsPanel() { // data init MediaScraper defaultMediaScraper = TvShowList.getInstance().getDefaultMediaScraper(); int selectedIndex = 0; int counter = 0; for (MediaScraper scraper : TvShowList.getInstance().getAvailableMediaScrapers()) { TvShowScraper tvShowScraper = new TvShowScraper(scraper); if (scraper.equals(defaultMediaScraper)) { tvShowScraper.defaultScraper = true; selectedIndex = counter; } scrapers.add(tvShowScraper); counter++; } List<String> enabledArtworkProviders = settings.getTvShowArtworkScrapers(); int artworkSelectedIndex = -1; int counterAW = 0; for (MediaScraper scraper : TvShowList.getInstance().getAvailableArtworkScrapers()) { ArtworkScraper artworkScraper = new ArtworkScraper(scraper); if (enabledArtworkProviders.contains(artworkScraper.getScraperId())) { artworkScraper.active = true; if (artworkSelectedIndex < 0) { artworkSelectedIndex = counterAW; } } artworkScrapers.add(artworkScraper); counterAW++; } // UI init setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); JPanel panelTvShowScrapers = new JPanel(); panelTvShowScrapers.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), BUNDLE.getString("scraper.metadata.defaults"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); // $NON-NLS-1$ add(panelTvShowScrapers, "2, 2, fill, top"); panelTvShowScrapers.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("100dlu:grow"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, })); scrollPaneScraper = new JScrollPane(); panelTvShowScrapers.add(scrollPaneScraper, "1, 2, 3, 1, fill, fill"); tableScraper = new JTable(); tableScraper.setRowHeight(29); scrollPaneScraper.setViewportView(tableScraper); scrollPaneScraperDetails = new JScrollPane(); scrollPaneScraperDetails.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPaneScraperDetails.setBorder(null); panelTvShowScrapers.add(scrollPaneScraperDetails, "5, 2, fill, fill"); panelScraperDetails = new ScrollablePanel(); scrollPaneScraperDetails.setViewportView(panelScraperDetails); panelScraperDetails.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("200dlu:grow"), }, new RowSpec[] { RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); // add a CSS rule to force body tags to use the default label font // instead of the value in javax.swing.text.html.default.csss Font font = UIManager.getFont("Label.font"); String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }"; tpScraperDescription = new JTextPane(); tpScraperDescription.setOpaque(false); tpScraperDescription.setEditorKit(new HTMLEditorKit()); ((HTMLDocument) tpScraperDescription.getDocument()).getStyleSheet().addRule(bodyRule); panelScraperDetails.add(tpScraperDescription, "1, 1, fill, top"); panelScraperOptions = new JPanel(); panelScraperOptions.setLayout(new FlowLayout(FlowLayout.LEFT)); panelScraperDetails.add(panelScraperOptions, "1, 3, fill, top"); JSeparator separator = new JSeparator(); panelTvShowScrapers.add(separator, "1, 4, 5, 1"); JLabel lblScraperLanguage = new JLabel(BUNDLE.getString("Settings.preferredLanguage")); //$NON-NLS-1$ panelTvShowScrapers.add(lblScraperLanguage, "1, 6, right, default"); cbScraperTmdbLanguage = new JComboBox(MediaLanguages.values()); panelTvShowScrapers.add(cbScraperTmdbLanguage, "3, 6"); JLabel lblCountry = new JLabel(BUNDLE.getString("Settings.certificationCountry")); //$NON-NLS-1$ panelTvShowScrapers.add(lblCountry, "1, 8, right, default"); cbCountry = new JComboBox(CountryCode.values()); panelTvShowScrapers.add(cbCountry, "3, 8, fill, default"); btnGroupThumbFilenaming = new ButtonGroup(); panelArtworkScrapers = new JPanel(); panelArtworkScrapers.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.images"), //$NON-NLS-1$ TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelArtworkScrapers, "2, 4, fill, fill"); panelArtworkScrapers.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("80dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, })); scrollPaneArtworkScraper = new JScrollPane(); panelArtworkScrapers.add(scrollPaneArtworkScraper, "2, 2, fill, fill"); tableArtworkScraper = new JTable(); tableArtworkScraper.setRowHeight(29); scrollPaneArtworkScraper.setViewportView(tableArtworkScraper); scrollPaneArtworkScraperDetails = new JScrollPane(); scrollPaneArtworkScraperDetails.setBorder(null); panelArtworkScrapers.add(scrollPaneArtworkScraperDetails, "4, 2, fill, fill"); panelArtworkScraperDetails = new JPanel(); scrollPaneArtworkScraperDetails.setViewportView(panelArtworkScraperDetails); panelArtworkScraperDetails.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), })); tpArtworkScraperDescription = new JTextPane(); tpArtworkScraperDescription.setEditorKit(new HTMLEditorKit()); ((HTMLDocument) tpArtworkScraperDescription.getDocument()).getStyleSheet().addRule(bodyRule); tpArtworkScraperDescription.setOpaque(false); panelArtworkScraperDetails.add(tpArtworkScraperDescription, "2, 2, fill, fill"); panelArtworkScraperOptions = new JPanel(); panelArtworkScraperOptions.setLayout(new FlowLayout(FlowLayout.LEFT)); panelArtworkScraperDetails.add(panelArtworkScraperOptions, "2, 4, fill, fill"); separator = new JSeparator(); panelArtworkScrapers.add(separator, "2, 4, 3, 1"); panelImages = new JPanel(); panelArtworkScrapers.add(panelImages, "2, 6, 3, 1, fill, fill"); panelImages.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { RowSpec.decode("23px"), })); lblNewLabel = new JLabel(BUNDLE.getString("image.thumb.naming")); panelImages.add(lblNewLabel, "1, 1, left, center"); rdbtnThumbWithPostfix = new JRadioButton("<dynamic>-thumb.ext"); panelImages.add(rdbtnThumbWithPostfix, "3, 1, fill, top"); btnGroupThumbFilenaming.add(rdbtnThumbWithPostfix); rdbtnThumbTbn = new JRadioButton("<dynamic>.tbn"); btnGroupThumbFilenaming.add(rdbtnThumbTbn); rdbtnThumbWoPostfix = new JRadioButton("<dynamic>.ext"); panelImages.add(rdbtnThumbWoPostfix, "5, 1, fill, top"); btnGroupThumbFilenaming.add(rdbtnThumbWoPostfix); panelImages.add(rdbtnThumbTbn, "7, 1"); panelScraperMetadataContainer = new JPanel(); panelScraperMetadataContainer.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), BUNDLE.getString("scraper.metadata.defaults"), TitledBorder.LEADING, TitledBorder.TOP, null, //$NON-NLS-1$ new Color(51, 51, 51))); add(panelScraperMetadataContainer, "2, 6, fill, top"); panelScraperMetadataContainer.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); panelScraperMetadata = new TvShowScraperMetadataPanel( Settings.getInstance().getTvShowScraperMetadataConfig()); panelScraperMetadataContainer.add(panelScraperMetadata, "1, 1, 2, 1, fill, default"); chckbxAutomaticallyScrapeImages = new JCheckBox(BUNDLE.getString("Settings.default.autoscrape")); //$NON-NLS-1$ panelScraperMetadataContainer.add(chckbxAutomaticallyScrapeImages, "2, 3"); initDataBindings(); { // adjust table columns // Checkbox and Logo shall have minimal width TableColumnResizer.setMaxWidthForColumn(tableScraper, 0, 2); TableColumnResizer.setMaxWidthForColumn(tableScraper, 1, 2); TableColumnResizer.adjustColumnPreferredWidths(tableScraper, 5); TableColumnResizer.setMaxWidthForColumn(tableArtworkScraper, 0, 2); TableColumnResizer.setMaxWidthForColumn(tableArtworkScraper, 1, 2); TableColumnResizer.adjustColumnPreferredWidths(tableArtworkScraper, 5); // implement listener to simulate button group tableScraper.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { // click on the checkbox if (arg0.getColumn() == 0) { int row = arg0.getFirstRow(); TvShowScraper changedScraper = scrapers.get(row); // if flag inNFO was changed, change all other trailers flags if (changedScraper.getDefaultScraper()) { settings.setTvShowScraper(changedScraper.getScraperId()); for (TvShowScraper scraper : scrapers) { if (scraper != changedScraper) { scraper.setDefaultScraper(Boolean.FALSE); } } } } } }); // implement selection listener to load settings tableScraper.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { int index = tableScraper.convertRowIndexToModel(tableScraper.getSelectedRow()); if (index > -1) { panelScraperOptions.removeAll(); if (scrapers.get(index).getMediaProvider().getProviderInfo().getConfig().hasConfig()) { panelScraperOptions.add( new MediaScraperConfigurationPanel(scrapers.get(index).getMediaProvider())); } panelScraperOptions.revalidate(); } } }); tableArtworkScraper.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { // click on the checkbox if (arg0.getColumn() == 0) { int row = arg0.getFirstRow(); ArtworkScraper changedScraper = artworkScrapers.get(row); if (changedScraper.active) { settings.addTvShowArtworkScraper(changedScraper.getScraperId()); } else { settings.removeTvShowArtworkScraper(changedScraper.getScraperId()); } } } }); // implement selection listener to load settings tableArtworkScraper.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { int index = tableArtworkScraper.convertRowIndexToModel(tableArtworkScraper.getSelectedRow()); if (index > -1) { panelArtworkScraperOptions.removeAll(); if (artworkScrapers.get(index).getMediaProvider().getProviderInfo().getConfig() .hasConfig()) { panelArtworkScraperOptions.add(new MediaScraperConfigurationPanel( artworkScrapers.get(index).getMediaProvider())); } panelArtworkScraperOptions.revalidate(); } } }); // select default TV show scraper if (counter > 0) { tableScraper.getSelectionModel().setSelectionInterval(selectedIndex, selectedIndex); } // select default artwork scraper if (counterAW > 0) { tableArtworkScraper.getSelectionModel().setSelectionInterval(artworkSelectedIndex, artworkSelectedIndex); } ItemListener itemListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { checkChanges(); } }; rdbtnThumbWoPostfix.addItemListener(itemListener); rdbtnThumbWithPostfix.addItemListener(itemListener); rdbtnThumbTbn.addItemListener(itemListener); switch (settings.getTvShowEpisodeThumbFilename()) { case FILENAME_THUMB_POSTFIX: rdbtnThumbWithPostfix.setSelected(true); break; case FILENAME_THUMB: rdbtnThumbWoPostfix.setSelected(true); break; case FILENAME_THUMB_TBN: rdbtnThumbTbn.setSelected(true); break; default: break; } } }
From source file:org.ut.biolab.medsavant.client.annotation.InstallAnnotationWizard.java
@Deprecated private AbstractWizardPage getAnnotationSourcePage() { return new DefaultWizardPage(PAGENAME_SRC) { private JRadioButton radioFromRepo = new JRadioButton("MedSavant public repository"); private JRadioButton radioFromFile = new JRadioButton("file (for custom annotations)"); {//from ww w.j a v a 2 s . c o m ButtonGroup g = new ButtonGroup(); g.add(radioFromRepo); //g.add(radioFromFile); final DefaultWizardPage instance = this; radioFromRepo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { setSourceFromRepo(radioFromRepo.isSelected(), instance); } }); radioFromFile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { setSourceFromRepo(radioFromRepo.isSelected(), instance); } }); addText("Install annotation from:"); addComponent(radioFromRepo); addComponent(radioFromFile); radioFromRepo.setSelected(true); } @Override public void setupWizardButtons() { fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH); fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.BACK); fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.NEXT); } }; }
From source file:org.ut.biolab.medsavant.client.filter.FilterHistoryPanel.java
public FilterHistoryPanel() { FilterController.getInstance().addListener(new Listener<FilterEvent>() { @Override// w w w .ja v a2 s. c o m public void handleEvent(final FilterEvent event) { new MedSavantWorker<Void>("FilterHistoryPanel") { @Override protected void showProgress(double fraction) { } @Override protected void showSuccess(Void result) { } @Override protected Void doInBackground() throws Exception { int numLeft = ResultController.getInstance().getFilteredVariantCount(); addFilterSet(event.getFilter(), event.getType(), numLeft); return null; } }.execute(); } }); ReferenceController.getInstance().addListener(new Listener<ReferenceEvent>() { @Override public void handleEvent(ReferenceEvent event) { if (event.getType() == ReferenceEvent.Type.CHANGED) { reset(); } } }); //this.setBackground(new Color(100,100,100)); this.setBorder(ViewUtil.getMediumBorder()); this.setMinimumSize(new Dimension(200, 300)); this.setPreferredSize(new Dimension(200, 300)); this.setName("History"); this.setLayout(new BorderLayout()); table = new JTable() { @Override public TableCellRenderer getCellRenderer(int row, int column) { if (model.getColumnClass(column).equals(JPanel.class)) { return new JPanelRenderer(); } return super.getCellRenderer(row, column); } }; model = new ProgressTableModel(); table.setModel(model); JPanel modePanel = ViewUtil.getClearPanel(); ButtonGroup group = new ButtonGroup(); JRadioButton globalButton = new JRadioButton("Global"); ViewUtil.makeSmall(globalButton); globalButton.setSelected(true); globalButton.setOpaque(false); JRadioButton relativeButton = new JRadioButton("Relative to previous change"); ViewUtil.makeSmall(relativeButton); relativeButton.setOpaque(false); globalButton.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { changeMode(Mode.GLOBAL); } }); relativeButton.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { changeMode(Mode.RELATIVE); } }); group.add(globalButton); group.add(relativeButton); modePanel.add(globalButton); modePanel.add(relativeButton); this.add(modePanel, BorderLayout.NORTH); final JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().add(table); this.add(scrollPane, BorderLayout.CENTER); reset(); //FilterController.addFilterListener(this); }