List of usage examples for javax.swing.event ChangeListener ChangeListener
ChangeListener
From source file:edu.ku.brc.specify.dbsupport.cleanuptools.GeoChooserDlg.java
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override//from w ww. j a v a 2s . co m public void createUI() { boolean doStatesOrCounties = doAllCountries[1] || doAllCountries[2] || doInvCountry[1] || doInvCountry[2]; //this.whichBtns = doStatesOrCounties && !doInvCountry[1] && rankId > 200 ? CustomDialog.OKCANCELAPPLYHELP : CustomDialog.OKCANCELHELP; boolean isStCnty = true;//rankId > 200; dataListModel = new DefaultListModel<GeoSearchResultsItem>(); mainList = new JList<GeoSearchResultsItem>(dataListModel); JScrollPane sb = createScrollPane(mainList, true); String listDim; if (UIHelper.isWindows()) { listDim = "250px"; Dimension sz = new Dimension(250, 250); mainList.setPreferredSize(sz); sb.setPreferredSize(sz); } else { listDim = "f:p:g"; } CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,2px,p,12px,p,2px," + listDim + ",8px,p,4px,p,10px,p" + (isStCnty ? ",8px,p" : ""))); this.contentPanel = pb.getPanel(); super.createUI(); okBtn.setEnabled(false); calcProgress(); try { if (coInfoList != null && coInfoList.size() > 0) { fillFromLuceneResults(); } else { fillFromQuery(); } mainList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { getOkBtn().doClick(); } else if (e.getClickCount() == 1 && !noMatchesFound && !mainList.isSelectionEmpty()) { getOkBtn().setEnabled(true); } } }); mainList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { listItemSelected(); } } }); updateNameCB = createCheckBox("Update the Name in the Geography tree."); // I18N //mergeCB = createCheckBox("Merge all the geographies with the same name."); addISOCodeCB = createCheckBox("Add the ISO Code to the record"); isoCodeTF = createTextField(8); isoCodeTF.setVisible(rankId < 400); updateNameCB.setSelected(isUpdateNamesChecked); //mergeCB.setSelected(true); addISOCodeCB.setSelected(true); updateNameCB.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent e) { isUpdateNamesChecked = updateNameCB.isSelected(); } }); DocumentListener dl = new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { okBtn.setEnabled(!isoCodeTF.getText().isEmpty()); } }; isoCodeTF.getDocument().addDocumentListener(dl); //labels.add(nameStr);// + " (Unknown)"); PanelBuilder lookPB = null; JButton lookupBtn = null; if (isStCnty) { lookPB = new PanelBuilder(new FormLayout("f:p:g,p", "p")); lookupBtn = createI18NButton("CLNUP_GEO_LOOK_UP_ISO"); lookPB.add(lookupBtn, cc.xy(2, 1)); lookupBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { globalRankSearch(); } }); } int i = 0; ArrayList<String> labels = new ArrayList<String>(); while (i < parentNames.length && parentRanks[i] > -1) { labels.add(i18NLabelsMap.get(parentRanks[i++])); } PanelBuilder pbTop = new PanelBuilder( new FormLayout("p,2px,f:p:g", UIHelper.createDuplicateJGoodiesDef("p", "2px", labels.size()))); int y = 1; for (i = 0; i < labels.size(); i++) { JLabel lbl = createLabel(parentNames[i]); pbTop.add(createFormLabel(labels.get(i)), cc.xy(1, y)); pbTop.add(lbl, cc.xy(3, y)); lbl.setBackground(Color.WHITE); lbl.setOpaque(true); y += 2; } pb.add(pbTop.getPanel(), cc.xy(1, 3)); pb.addSeparator("Possible standard Geography choices", cc.xy(1, 5)); // I18N pb.add(sb, cc.xy(1, 7)); pb.add(updateNameCB, cc.xy(1, 9)); PanelBuilder pbc = new PanelBuilder(new FormLayout("p,10px,p,f:p:g", "p")); pbc.add(addISOCodeCB, cc.xy(1, 1)); pbc.add(isoCodeTF, cc.xy(3, 1)); pb.add(pbc.getPanel(), cc.xy(1, 11)); i = 13; if (isStCnty) { pb.add(lookPB.getPanel(), cc.xy(1, i)); i += 2; } //if (doAllCountries[0]) if (false) // hidding it for now { progressBar = new JProgressBar(0, 100); progressBar.setStringPainted(true); PanelBuilder prgPB = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p")); prgPB.add(createFormLabel("Progress"), cc.xy(1, 1)); prgPB.add(progressBar, cc.xy(3, 1)); pb.add(prgPB.getPanel(), cc.xy(1, i)); i += 2; } mainList.setSelectedIndex(selectedIndex); mainList.ensureIndexIsVisible(selectedIndex); noMatchesFound = dataListModel.size() == 0; // Optional Depending on States / Countries if (doStatesOrCounties) { if (dataListModel.getSize() == 0) { dataListModel.addElement(new GeoSearchResultsItem("No matches found."));// I18N } } pb.setDefaultDialogBorder(); } catch (Exception ex) { ex.printStackTrace(); } if (UIHelper.isWindows()) { setResizable(false); } setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // Must be called at the end 'createUI' }
From source file:edu.ku.brc.specify.dbsupport.cleanuptools.GeographyAssignISOs.java
/** * @return//from w w w. j ava 2 s .co m */ @SuppressWarnings("rawtypes") public boolean buildAsync(final int earthID) { this.earthId = earthID; if (processingPhase == ProcessingState.eInitialPass) { processingPhase = ProcessingState.eAllCountriesPass; doAllCountries = new boolean[] { true, false, false, false }; doInvCountry = new boolean[] { false, false, false, false }; doIndvCountryId = null; // Check to see if it needs indexing. boolean shouldIndex = luceneSearch.shouldIndex(); if (shouldIndex) { frame = new ProgressFrame("Building Geography Authority..."); // I18N frame.getCloseBtn().setVisible(false); frame.turnOffOverAll(); frame.setDesc("Loading Geonames data..."); // I18N frame.pack(); frame.setSize(450, frame.getBounds().height + 10); UIHelper.centerAndShow(frame, 450, frame.getBounds().height + 10); luceneSearch.startIndexingProcessAsync(earthId, frame, new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { frame.setVisible(false); frame = null; if (((Boolean) e.getSource())) { GeographyAssignISOs.this.startTraversal(); } } }); } else { String sql = "SELECT Name, geonameId, iso_alpha2 FROM countryinfo"; for (Object[] row : query(sql)) { countryInfo.add(new GeoSearchResultsItem((String) row[0], (Integer) row[1], (String) row[2])); } startTraversal(); } } else { if (processingPhase == ProcessingState.eStartIndvCountryPass) { String sql = "SELECT GeographyID FROM geography WHERE GeographyCode = 'US'"; for (Integer recId : queryForInts(sql)) { usaIds.add(recId); } processingPhase = ProcessingState.eIndvCountryPass; } if (usaIds.size() > 0) { doAllCountries = new boolean[] { true, false, false, false }; doInvCountry = new boolean[] { true, true, false, false }; doIndvCountryId = usaIds.get(0); usaIds.remove(0); startTraversal(); } else { processingPhase = ProcessingState.eProcessingDone; shutdown(); } } return true; }
From source file:com.att.aro.ui.view.waterfalltab.WaterfallPanel.java
/** * @return the verticalScroll//from w w w. ja v a 2s. co m */ private JScrollBar getVerticalScroll() { if (verticalScroll == null) { verticalScroll = new JScrollBar(JScrollBar.VERTICAL, 0, 100, 0, 100); verticalScroll.getModel().addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { if (dataset.getColumnCount() > 0) { dataset.setFirstCategoryIndex(verticalScroll.getValue()); } } }); } return verticalScroll; }
From source file:edu.gmu.cs.sim.util.media.chart.BoxPlotGenerator.java
protected void buildGlobalAttributes(LabelledList list) { // create the chart ((CategoryPlot) (chart.getPlot())).setRangeGridlinesVisible(false); ((CategoryPlot) (chart.getPlot())).setRangeGridlinePaint(new Color(200, 200, 200)); xLabel = new PropertyField() { public String newValue(String newValue) { setXAxisLabel(newValue);//from w ww . j a v a2 s . c o m getChartPanel().repaint(); return newValue; } }; xLabel.setValue(getXAxisLabel()); list.add(new JLabel("X Label"), xLabel); yLabel = new PropertyField() { public String newValue(String newValue) { setYAxisLabel(newValue); getChartPanel().repaint(); return newValue; } }; yLabel.setValue(getYAxisLabel()); list.add(new JLabel("Y Label"), yLabel); yLog = new JCheckBox(); yLog.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (yLog.isSelected()) { LogarithmicAxis logAxis = new LogarithmicAxis(yLabel.getValue()); logAxis.setStrictValuesFlag(false); ((CategoryPlot) (chart.getPlot())).setRangeAxis(logAxis); } else { ((CategoryPlot) (chart.getPlot())).setRangeAxis(new NumberAxis(yLabel.getValue())); } } }); list.add(new JLabel("Y Log Axis"), yLog); final JCheckBox ygridlines = new JCheckBox(); ygridlines.setSelected(false); ItemListener il = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ((CategoryPlot) (chart.getPlot())).setRangeGridlinesVisible(true); } else { ((CategoryPlot) (chart.getPlot())).setRangeGridlinesVisible(false); } } }; ygridlines.addItemListener(il); // JFreeChart's Box Plots look awful when wide because the mean // circle is based on the width of the bar to the exclusion of all // else. So I've restricted the width to be no more than 0.4, and 0.1 // is the suggested default. final double INITIAL_WIDTH = 0.1; final double MAXIMUM_RATIONAL_WIDTH = 0.4; maximumWidthField = new NumberTextField(INITIAL_WIDTH, 2.0, 0) { public double newValue(double newValue) { if (newValue <= 0.0 || newValue > MAXIMUM_RATIONAL_WIDTH) { newValue = currentValue; } ((BoxAndWhiskerRenderer) (((CategoryPlot) (chart.getPlot())).getRenderer())) .setMaximumBarWidth(newValue); //update(); return newValue; } }; list.addLabelled("Max Width", maximumWidthField); Box box = Box.createHorizontalBox(); box.add(new JLabel(" Y")); box.add(ygridlines); box.add(Box.createGlue()); list.add(new JLabel("Y Grid Lines"), ygridlines); mean = new JCheckBox(); mean.setSelected(true); il = new ItemListener() { public void itemStateChanged(ItemEvent e) { BoxAndWhiskerRenderer renderer = ((BoxAndWhiskerRenderer) ((CategoryPlot) (chart.getPlot())) .getRenderer()); renderer.setMeanVisible(mean.isSelected()); } }; mean.addItemListener(il); median = new JCheckBox(); median.setSelected(true); il = new ItemListener() { public void itemStateChanged(ItemEvent e) { BoxAndWhiskerRenderer renderer = ((BoxAndWhiskerRenderer) ((CategoryPlot) (chart.getPlot())) .getRenderer()); renderer.setMedianVisible(median.isSelected()); } }; median.addItemListener(il); list.add(new JLabel("Mean"), mean); list.add(new JLabel("Median"), median); final JCheckBox horizontal = new JCheckBox(); horizontal.setSelected(false); il = new ItemListener() { public void itemStateChanged(ItemEvent e) { CategoryPlot plot = (CategoryPlot) (chart.getPlot()); if (e.getStateChange() == ItemEvent.SELECTED) { plot.setOrientation(PlotOrientation.HORIZONTAL); } else { plot.setOrientation(PlotOrientation.VERTICAL); } //updateGridLines(); } }; horizontal.addItemListener(il); list.add(new JLabel("Horizontal"), horizontal); final JCheckBox whiskersUseFillColorButton = new JCheckBox(); whiskersUseFillColorButton.setSelected(false); whiskersUseFillColorButton.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { BoxAndWhiskerRenderer renderer = ((BoxAndWhiskerRenderer) ((CategoryPlot) (chart.getPlot())) .getRenderer()); renderer.setUseOutlinePaintForWhiskers(!whiskersUseFillColorButton.isSelected()); } }); box = Box.createHorizontalBox(); box.add(new JLabel(" Colored")); box.add(whiskersUseFillColorButton); box.add(Box.createGlue()); list.add(new JLabel("Whiskers"), box); }
From source file:com.titan.mainframe.MainFrame.java
public MainFrame() { String osName = System.getProperty("os.name").toLowerCase(); if (osName.toLowerCase().contains("mac")) { com.apple.eawt.Application macApp = com.apple.eawt.Application.getApplication(); macApp.addApplicationListener(this); }/*from w w w . ja v a 2 s . c o m*/ addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { handleQuit(); } @Override public void windowOpened(WindowEvent e) { windowOpened = true; } }); setTitle("Titan " + Global.version); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); if (TitanSetting.getInstance().width == 0 || TitanSetting.getInstance().height == 0) { setBounds(TitanSetting.getInstance().x, TitanSetting.getInstance().y, 1200, 700); } else { setBounds(TitanSetting.getInstance().x, TitanSetting.getInstance().y, TitanSetting.getInstance().width, TitanSetting.getInstance().height); } setIconImage(new ImageIcon(getClass().getClassLoader().getResource("com/titan/image/titan_icon.png")) .getImage()); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(new BorderLayout(0, 0)); splitPane.setDividerLocation(TitanSetting.getInstance().mainframeDivX); contentPane.add(splitPane, BorderLayout.CENTER); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout(0, 0)); JLabel logoLabel = new JLabel(); logoLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { mainContentPanel.removeAll(); mainContentPanel.add(welcomePanel, BorderLayout.CENTER); mainContentPanel.updateUI(); } }); // try { // BufferedImage b = ImageIO.read(MainFrame.class.getResource("/com/titan/image/titanLogo.png")); // Image i = b.getScaledInstance((int) (b.getWidth() * 0.6), (int) (b.getHeight() * 0.6), Image.SCALE_SMOOTH); logoLabel.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/titanLogo.png"))); // } catch (IOException e1) { // e1.printStackTrace(); // } // logoLabel.setMaximumSize(new Dimension(150, 150)); JPanel controlPanel = new JPanel(); controlPanel.setBackground(new Color(239, 249, 255)); controlPanel.setOpaque(true); panel.add(controlPanel, BorderLayout.CENTER); controlPanel.setLayout(new BorderLayout()); JScrollPane computeScrollPane = new JScrollPane(); tabbedPane.addTab("Compute", computeScrollPane); controlPanel.add(tabbedPane, BorderLayout.CENTER); serverTree = new JTree(); serverTree.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { // Object obj = mainContentPanel.getComponent(0); // if (obj instanceof VMMainPanel) { // ((MainPanel) obj).refresh(); // } } }); serverTree.setModel(computeTreeModel); serverTree.setCellRenderer(new ZoneTreeRenderer()); serverTree.setRootVisible(false); computeScrollPane.setViewportView(serverTree); updateComputeTree(); JScrollPane zoneScrollPane = new JScrollPane(); tabbedPane.addTab("Zone", zoneScrollPane); zoneTree = new JTree(); zoneTree.setModel(zoneTreeModel); zoneTree.setCellRenderer(new ZoneTreeRenderer()); zoneScrollPane.setViewportView(zoneTree); updateZoneTree(); splitPane.setLeftComponent(panel); splitPane.setRightComponent(mainContentPanel); mainContentPanel.setLayout(new BorderLayout(0, 0)); welcomePanel = new WelcomePanel(); mainContentPanel.add(welcomePanel, BorderLayout.CENTER); welcomePanel.setLayout(new BorderLayout(0, 0)); welcomePanel.add(mainScreenLabel, BorderLayout.CENTER); mainScreenLabel.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/mainscreen.png"))); JPanel panel_1 = new JPanel(); welcomePanel.add(panel_1, BorderLayout.SOUTH); JButton licenseButton = new JButton("License"); licenseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { InputStream in = MainFrame.class.getResourceAsStream("/com/titan/license.txt"); try { LicenseDialog dialog = new LicenseDialog(MainFrame.this, IOUtils.toString(in)); CommonLib.centerDialog(dialog); dialog.setVisible(true); } catch (IOException e1) { e1.printStackTrace(); } finally { IOUtils.closeQuietly(in); } } }); panel_1.add(licenseButton); ribbonPanel = new JPanel(); contentPane.add(ribbonPanel, BorderLayout.NORTH); ribbonPanel.setLayout(new BorderLayout(0, 0)); ribbonTabbedPane = new JTabbedPane(JTabbedPane.TOP); ribbonTabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { // if (!windowOpened) { // return; // } String tab = ribbonTabbedPane.getTitleAt(ribbonTabbedPane.getSelectedIndex()); if (tab.equals("Server")) { if (mainServerPanel == null || !mainServerPanel.serverPanel.jprogressBarDialog.isActive()) { SwingUtilities.invokeLater(new Runnable() { public void run() { mainContentPanel.removeAll(); mainServerPanel = new MainServerPanel(MainFrame.this); mainContentPanel.add(mainServerPanel, BorderLayout.CENTER); mainContentPanel.updateUI(); } }); } } else if (tab.equals("VM")) { SwingUtilities.invokeLater(new Runnable() { public void run() { mainContentPanel.removeAll(); mainContentPanel.add(new VMMainPanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } }); } else if (tab.equals("Keystone")) { mainContentPanel.removeAll(); mainContentPanel.add(new KeystonePanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } else if (tab.equals("Flavor")) { mainContentPanel.removeAll(); mainContentPanel.add(new FlavorPanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } else if (tab.equals("Storage")) { mainContentPanel.removeAll(); mainContentPanel.add(new StoragePanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } else if (tab.equals("Network")) { mainContentPanel.removeAll(); mainContentPanel.add(new SDNPanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } else if (tab.equals("Setting")) { mainContentPanel.removeAll(); mainContentPanel.add(new SettingPanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } } }); ribbonTabbedPane.putClientProperty("type", "ribbonType"); ribbonTabbedPane.setPreferredSize(new Dimension(1000, 140)); ribbonPanel.add(ribbonTabbedPane, BorderLayout.CENTER); serverPanel = new JRibbonPanel(); serverPanel.setLayout(new MigLayout("", "[][][][][][][][][][][][][][grow][]", "[grow][grow][]")); ribbonTabbedPane.addTab("Server", null, serverPanel, null); logoutButton = new JRibbonBigButton("Logout"); logoutButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { logout(); } }); rbnbgbtnAddServer = new JRibbonBigButton(); rbnbgbtnAddServer.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png"))); rbnbgbtnAddServer.setText("Add Server"); serverPanel.add(rbnbgbtnAddServer, "cell 0 0 1 3,growy"); rbnbgbtnDeleteServer = new JRibbonBigButton(); rbnbgbtnDeleteServer .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png"))); rbnbgbtnDeleteServer.setText("Delete Server"); serverPanel.add(rbnbgbtnDeleteServer, "cell 1 0 1 3,growy"); logoutButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/logout.png"))); logoutButton.setVerticalTextPosition(SwingConstants.BOTTOM); logoutButton.setHorizontalTextPosition(SwingConstants.CENTER); serverPanel.add(logoutButton, "cell 14 0 1 3,growy"); vmPanel = new JRibbonPanel(); ribbonTabbedPane.addTab("VM", null, vmPanel, null); vmPanel.setLayout(new MigLayout("", "[][][][][][][][][][][][][][][grow][]", "[grow][grow][]")); launchButton = new JRibbonBigButton("Launch"); launchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new LaunchInstanceDialog(MainFrame.this).setVisible(true); } }); launchButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/launch.png"))); launchButton.setVerticalTextPosition(SwingConstants.BOTTOM); launchButton.setHorizontalTextPosition(SwingConstants.CENTER); vmPanel.add(launchButton, "cell 0 0 1 3,growy"); pauseButton = new JRibbonButton("Pause"); pauseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova pause"); } }); pauseButton.setHorizontalAlignment(SwingConstants.LEFT); pauseButton.setIcon( new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/control_pause.png"))); vmPanel.add(pauseButton, "cell 2 0,growx"); stopButton = new JRibbonButton("Stop"); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova stop"); } }); stopButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/stop.png"))); stopButton.setVerticalTextPosition(SwingConstants.BOTTOM); stopButton.setHorizontalTextPosition(SwingConstants.CENTER); vmPanel.add(stopButton, "cell 1 0 1 3,growy"); unpauseButton = new JRibbonButton("Unpause"); unpauseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova unpause"); } }); unpauseButton.setHorizontalAlignment(SwingConstants.LEFT); unpauseButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/control_play.png"))); suspendButton = new JRibbonButton("Suspend"); suspendButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova suspend"); } }); suspendButton.setHorizontalAlignment(SwingConstants.LEFT); suspendButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/disk.png"))); vmPanel.add(suspendButton, "cell 3 0,growx"); softRebootButton = new JRibbonButton("Soft reboot"); softRebootButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova soft-reboot"); } }); softRebootButton.setHorizontalAlignment(SwingConstants.LEFT); softRebootButton.setIcon(new ImageIcon( MainFrame.class.getResource("/com/titan/image/famfamfam/arrow_rotate_clockwise.png"))); selectAllVMButton = new JRibbonButton("Select all"); selectAllVMButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.selectAll(); } }); vmPanel.add(selectAllVMButton, "cell 4 0,growx"); vmPanel.add(softRebootButton, "cell 9 0,growx"); createMacroButton = new JRibbonButton("Create macro"); createMacroButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png"))); createMacroButton.setHorizontalAlignment(SwingConstants.LEFT); setGroupNameButton = new JRibbonButton("Set group name"); setGroupNameButton.setHorizontalAlignment(SwingConstants.LEFT); setGroupNameButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.setGroupName(); } }); vmPanel.add(setGroupNameButton, "cell 10 0"); vmPanel.add(createMacroButton, "cell 13 0,growx"); ribbonSeparator_3 = new JRibbonSeparator(); vmPanel.add(ribbonSeparator_3, "cell 14 0 1 3,growy"); vmPanel.add(unpauseButton, "cell 2 1,growx"); remoteButton = new JRibbonButton("Remote"); remoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.remote(); } }); remoteButton.setHorizontalAlignment(SwingConstants.LEFT); remoteButton.setIcon(new ImageIcon( MainFrame.class.getResource("/com/titan/image/famfamfam/application_osx_terminal.png"))); unselectAllButton = new JRibbonButton("Unselect all"); unselectAllButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.unselectAll(); } }); vmPanel.add(unselectAllButton, "cell 4 1,growx"); vmPanel.add(remoteButton, "cell 2 2,growx"); performanceMeterButton = new JRibbonButton("Performance meter"); performanceMeterButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/chart_curve.png"))); performanceMeterButton.setHorizontalAlignment(SwingConstants.LEFT); vmPanel.add(performanceMeterButton, "cell 13 1,growx"); resumeButton = new JRibbonButton("Resume"); resumeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova resume"); } }); resumeButton.setHorizontalAlignment(SwingConstants.LEFT); resumeButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/drive_disk.png"))); vmPanel.add(resumeButton, "cell 3 1,growx"); deleteButton = new JRibbonBigButton("Delete"); deleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova delete"); } }); vmPanel.add(deleteButton, "cell 7 0 1 3,alignx center,growy"); deleteButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png"))); deleteButton.setVerticalTextPosition(SwingConstants.BOTTOM); deleteButton.setHorizontalTextPosition(SwingConstants.CENTER); logButton = new JRibbonBigButton("Log"); logButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.log(); } }); vmPanel.add(logButton, "cell 6 0 1 3,alignx center,growy"); logButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/log.png"))); logButton.setVerticalTextPosition(SwingConstants.BOTTOM); logButton.setHorizontalTextPosition(SwingConstants.CENTER); hardRebootButton = new JRibbonButton("Hard reboot"); hardRebootButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova hard-reboot"); } }); hardRebootButton.setHorizontalAlignment(SwingConstants.LEFT); hardRebootButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/arrow_undo.png"))); ribbonSeparator = new JRibbonSeparator(); vmPanel.add(ribbonSeparator, "cell 5 0 1 3,alignx center,growy"); ribbonSeparator_1 = new JRibbonSeparator(); vmPanel.add(ribbonSeparator_1, "cell 8 0 1 3,alignx center,growy"); vmPanel.add(hardRebootButton, "cell 9 1,growx"); ribbonSeparator_2 = new JRibbonSeparator(); vmPanel.add(ribbonSeparator_2, "cell 11 0 1 3,grow"); macroButton = new JRibbonBigButton("Macro"); macroButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/code.png"))); macroButton.setVerticalTextPosition(SwingConstants.BOTTOM); macroButton.setHorizontalTextPosition(SwingConstants.CENTER); vmPanel.add(macroButton, "cell 12 0 1 3,growy"); snapshotButton = new JRibbonButton("Snapshot"); snapshotButton.setHorizontalAlignment(SwingConstants.LEFT); snapshotButton.setIcon( new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/application_cascade.png"))); vmPanel.add(snapshotButton, "cell 3 2,growx"); advanceButton = new JRibbonButton("Advance"); advanceButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); advanceButton.setHorizontalAlignment(SwingConstants.LEFT); advanceButton.setIcon(new ImageIcon( MainFrame.class.getResource("/com/titan/image/famfamfam/application_view_detail.png"))); vmPanel.add(advanceButton, "cell 9 2,growx"); executionMapButton = new JRibbonButton("Execution map"); executionMapButton.setIcon( new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/chart_organisation.png"))); executionMapButton.setHorizontalAlignment(SwingConstants.LEFT); vmPanel.add(executionMapButton, "cell 13 2,growx"); keystonePanel = new JRibbonPanel(); ribbonTabbedPane.addTab("Keystone", null, keystonePanel, null); keystonePanel.setLayout(new MigLayout("", "[][][][][][][][][][]", "[grow][][][][]")); addUserButton = new JRibbonBigButton("Add user"); addUserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.addUser(); } }); addUserButton.setVerticalTextPosition(SwingConstants.BOTTOM); addUserButton.setHorizontalTextPosition(SwingConstants.CENTER); addUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/addUser.png"))); keystonePanel.add(addUserButton, "cell 0 0 1 3,growy"); editUserButton = new JRibbonButton("Edit user"); editUserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); editUserButton.setHorizontalAlignment(SwingConstants.LEFT); editUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png"))); keystonePanel.add(editUserButton, "cell 1 0,growx"); changePasswordButton = new JRibbonButton("Change password"); keystonePanel.add(changePasswordButton, "cell 2 0"); ribbonSeparator_4 = new JRibbonSeparator(); keystonePanel.add(ribbonSeparator_4, "cell 3 0 1 3,growy"); addRoleButton = new JRibbonBigButton("Add role"); addRoleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.addRole(); } }); addRoleButton.setVerticalTextPosition(SwingConstants.BOTTOM); addRoleButton.setHorizontalTextPosition(SwingConstants.CENTER); addRoleButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/addRole.png"))); keystonePanel.add(addRoleButton, "cell 4 0 1 3,growy"); deleteUserButton = new JRibbonButton("Delete user"); deleteUserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); deleteUserButton.setHorizontalAlignment(SwingConstants.LEFT); deleteUserButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); editRoleButton = new JRibbonButton("Edit role"); editRoleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); editRoleButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png"))); editRoleButton.setHorizontalAlignment(SwingConstants.LEFT); keystonePanel.add(editRoleButton, "cell 5 0,growx"); ribbonSeparator_5 = new JRibbonSeparator(); keystonePanel.add(ribbonSeparator_5, "cell 6 0 1 3,growy"); createTenantButton = new JRibbonBigButton("Create tenant"); createTenantButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.createTenant(); } }); createTenantButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png"))); createTenantButton.setVerticalTextPosition(SwingConstants.BOTTOM); createTenantButton.setHorizontalTextPosition(SwingConstants.CENTER); keystonePanel.add(createTenantButton, "cell 7 0 1 3,growy"); deleteTenantButton = new JRibbonBigButton("Delete tenant"); deleteTenantButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.deleteTenant(); } }); deleteTenantButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png"))); deleteTenantButton.setVerticalTextPosition(SwingConstants.BOTTOM); deleteTenantButton.setHorizontalTextPosition(SwingConstants.CENTER); keystonePanel.add(deleteTenantButton, "cell 8 0 1 3,growy"); keystonePanel.add(deleteUserButton, "cell 1 1,growx"); detailUserButton = new JRibbonButton("Detail user"); detailUserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.showUserDetail(); } }); detailUserButton.setHorizontalAlignment(SwingConstants.LEFT); detailUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/zoom.png"))); keystonePanel.add(detailUserButton, "cell 1 2,growx"); btnDeleteRole = new JRibbonButton("Delete role"); btnDeleteRole.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.deleteRole(); } }); btnDeleteRole.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); keystonePanel.add(btnDeleteRole, "cell 5 1,growx"); assignRoleButton = new JRibbonButton("Assign role"); assignRoleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.assignRole(); } }); assignRoleButton.setSelectedIcon( new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/user_add.png"))); keystonePanel.add(assignRoleButton, "cell 5 2,growx"); lblUser = new JRibbonLabel("user"); keystonePanel.add(lblUser, "cell 0 3 2 1,growx"); rbnlblRole = new JRibbonLabel("role"); keystonePanel.add(rbnlblRole, "cell 4 3 2 1,growx"); rbnlblTenant = new JRibbonLabel(); rbnlblTenant.setText("tenant"); keystonePanel.add(rbnlblTenant, "cell 7 3 2 1,growx"); flavorPanel = new JRibbonPanel(); ribbonTabbedPane.addTab("Flavor", null, flavorPanel, null); flavorPanel.setLayout(new MigLayout("", "[][]", "[grow][][][]")); rbnbgbtnCreateFlavor = new JRibbonBigButton(); rbnbgbtnCreateFlavor.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png"))); rbnbgbtnCreateFlavor.setText("Create Flavor"); flavorPanel.add(rbnbgbtnCreateFlavor, "cell 0 0 1 3,growy"); btnDeleteFlavor = new JRibbonBigButton("Delete Flavor"); btnDeleteFlavor.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png"))); flavorPanel.add(btnDeleteFlavor, "cell 1 0 1 3,growy"); storagePanel = new JRibbonPanel(); ribbonTabbedPane.addTab("Storage", null, storagePanel, null); storagePanel.setLayout(new MigLayout("", "[][][][][][]", "[grow][][][]")); uploadImageButton = new JRibbonBigButton("Upload"); uploadImageButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png"))); uploadImageButton.setVerticalTextPosition(SwingConstants.BOTTOM); uploadImageButton.setHorizontalTextPosition(SwingConstants.CENTER); storagePanel.add(uploadImageButton, "cell 0 0 1 3, growy"); btnDelete = new JRibbonButton("Delete"); btnDelete.setHorizontalAlignment(SwingConstants.LEFT); btnDelete.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); storagePanel.add(btnDelete, "cell 1 0,growx"); ribbonSeparator_6 = new JRibbonSeparator(); storagePanel.add(ribbonSeparator_6, "cell 2 0 1 3,grow"); btnCreateVolume = new JRibbonBigButton("Create volume"); btnCreateVolume.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png"))); btnCreateVolume.setVerticalTextPosition(SwingConstants.BOTTOM); btnCreateVolume.setHorizontalTextPosition(SwingConstants.CENTER); storagePanel.add(btnCreateVolume, "cell 3 0 1 3,growy"); btnDelete_1 = new JRibbonButton("Delete"); btnDelete_1.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); btnDelete_1.setHorizontalAlignment(SwingConstants.LEFT); storagePanel.add(btnDelete_1, "cell 4 0,growx"); btnAttach = new JRibbonButton("Attach to vm"); btnAttach.setHorizontalAlignment(SwingConstants.LEFT); btnAttach.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/attach.png"))); storagePanel.add(btnAttach, "cell 5 0,growx"); btnChangeName = new JRibbonButton("Change name"); btnChangeName.setHorizontalAlignment(SwingConstants.LEFT); btnChangeName.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png"))); storagePanel.add(btnChangeName, "cell 1 1,growx"); btnDetail = new JRibbonButton("Detail"); btnDetail.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/zoom.png"))); btnDetail.setHorizontalAlignment(SwingConstants.LEFT); storagePanel.add(btnDetail, "cell 4 1,growx"); btnDetachToVm = new JRibbonButton("Detach to vm"); btnDetachToVm.setHorizontalAlignment(SwingConstants.LEFT); btnDetachToVm.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/delete.png"))); storagePanel.add(btnDetachToVm, "cell 5 1,growx"); btnPublicprivate = new JRibbonButton("public/private"); btnPublicprivate.setHorizontalAlignment(SwingConstants.LEFT); btnPublicprivate.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/tick.png"))); storagePanel.add(btnPublicprivate, "cell 1 2,growx"); btnAddVolumeType = new JRibbonButton("Add volume type"); btnAddVolumeType.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png"))); btnAddVolumeType.setHorizontalAlignment(SwingConstants.LEFT); storagePanel.add(btnAddVolumeType, "cell 4 2"); btnDeleteVolumeType = new JRibbonButton("Delete volume type"); btnDeleteVolumeType .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); btnDeleteVolumeType.setHorizontalAlignment(SwingConstants.LEFT); storagePanel.add(btnDeleteVolumeType, "cell 5 2"); rbnlblImage = new JRibbonLabel(); rbnlblImage.setText("Image"); storagePanel.add(rbnlblImage, "cell 0 3 2 1,growx"); rbnlblVolume = new JRibbonLabel(); rbnlblVolume.setText("Volume"); storagePanel.add(rbnlblVolume, "cell 3 3 3 1,growx"); networkPanel = new JRibbonPanel(); ribbonTabbedPane.addTab("Network", null, networkPanel, null); settingPanel = new JRibbonPanel(); ribbonTabbedPane.addTab("Setting", null, settingPanel, null); settingPanel.setLayout(new MigLayout("", "[][][]", "[grow][grow][]")); rbnbgbtnSystemSetting = new JRibbonBigButton(); rbnbgbtnSystemSetting .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/systemSetting.png"))); rbnbgbtnSystemSetting.setText("System Setting"); settingPanel.add(rbnbgbtnSystemSetting, "cell 0 0 1 3,growy"); rbnbgbtnDatabase = new JRibbonBigButton(); rbnbgbtnDatabase .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/database.png"))); rbnbgbtnDatabase.setText("Database"); settingPanel.add(rbnbgbtnDatabase, "cell 1 0 1 3,growy"); rbnbtnAddGroup = new JRibbonButton(); rbnbtnAddGroup.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png"))); rbnbtnAddGroup.setText("Add Group"); settingPanel.add(rbnbtnAddGroup, "cell 2 0"); rbnbtnEditGroup = new JRibbonButton(); rbnbtnEditGroup .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png"))); rbnbtnEditGroup.setText("Edit Group"); settingPanel.add(rbnbtnEditGroup, "cell 2 1"); rbnbtnDeleteGroup = new JRibbonButton(); rbnbtnDeleteGroup .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); rbnbtnDeleteGroup.setText("Delete Group"); settingPanel.add(rbnbtnDeleteGroup, "cell 2 2"); logoPanel = new JRibbonPanel(); ribbonPanel.add(logoPanel, BorderLayout.WEST); logoPanel.setLayout(new BorderLayout(0, 0)); logoPanel.add(logoLabel, BorderLayout.CENTER); setLocationRelativeTo(null); new Thread(new TitanServerUpdateThread()).start(); }
From source file:SoundPlayer.java
void addMidiControls() { // Add a slider to control the tempo final JSlider tempo = new JSlider(50, 200); tempo.setValue((int) (sequencer.getTempoFactor() * 100)); tempo.setBorder(new TitledBorder("Tempo Adjustment (%)")); java.util.Hashtable labels = new java.util.Hashtable(); labels.put(new Integer(50), new JLabel("50%")); labels.put(new Integer(100), new JLabel("100%")); labels.put(new Integer(200), new JLabel("200%")); tempo.setLabelTable(labels);//from w ww .jav a 2s . c o m tempo.setPaintLabels(true); // The event listener actually changes the tmpo tempo.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sequencer.setTempoFactor(tempo.getValue() / 100.0f); } }); this.add(tempo); // Create rows of solo and checkboxes for each track Track[] tracks = sequence.getTracks(); for (int i = 0; i < tracks.length; i++) { final int tracknum = i; // Two checkboxes per track final JCheckBox solo = new JCheckBox("solo"); final JCheckBox mute = new JCheckBox("mute"); // The listeners solo or mute the track solo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { sequencer.setTrackSolo(tracknum, solo.isSelected()); } }); mute.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { sequencer.setTrackMute(tracknum, mute.isSelected()); } }); // Build up a row Box box = Box.createHorizontalBox(); box.add(new JLabel("Track " + tracknum)); box.add(Box.createHorizontalStrut(10)); box.add(solo); box.add(Box.createHorizontalStrut(10)); box.add(mute); box.add(Box.createHorizontalGlue()); // And add it to this component this.add(box); } }
From source file:com.att.aro.ui.view.waterfalltab.WaterfallPanel.java
/** * @return the horizontalScroll/*from www . java 2 s . c o m*/ */ private JScrollBar getHorizontalScroll() { if (horizontalScroll == null) { horizontalScroll = new JScrollBar(JScrollBar.HORIZONTAL, 0, DEFAULT_TIMELINE, 0, DEFAULT_TIMELINE); horizontalScroll.getModel().addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { int scrollStart = horizontalScroll.getValue(); int scrollEnd = scrollStart + horizontalScroll.getVisibleAmount(); //logger.log(Level.FINE, "Change Event: Setting time range to {0} - {1}", new Object[] {scrollStart, scrollEnd}); // Set time axis range based on scroll bar new position timeAxis.setRange(scrollStart, scrollEnd); } }); } return horizontalScroll; }
From source file:com.diversityarrays.kdxplore.design.EntryFileImportDialog.java
public EntryFileImportDialog(Window owner, String title, File inputFile, Predicate<Role> entryHeadingFilter) { super(owner, title, ModalityType.APPLICATION_MODAL); this.entryHeadingFilter = entryHeadingFilter; setDefaultCloseOperation(DISPOSE_ON_CLOSE); setGlassPane(backgroundRunner.getBlockingPane()); useScrollBarOption.addActionListener(new ActionListener() { @Override//from w ww . j av a 2 s. c o m public void actionPerformed(ActionEvent e) { updateDataPreviewScrolling(); } }); headingRoleTableModel = createHeadingRoleTableModel(); headingRoleTable = new HeadingRoleTable<>(headingRoleTableModel); headingTableScrollPane = new JScrollPane(headingRoleTable); GuiUtil.setVisibleRowCount(headingRoleTable, 10); JPanel roleAssignmentPanel = new JPanel(new BorderLayout()); roleAssignmentPanel.add(headingTableScrollPane, BorderLayout.CENTER); headingRoleTable.setTransferHandler(flth); headingRoleTableModel.addChangeListener(headingRoleChangeListener); GuiUtil.setVisibleRowCount(dataPreviewTable, 10); dataPreviewTable.setTransferHandler(flth); dataPreviewScrollPane.setTransferHandler(flth); updateDataPreviewScrolling(); dataPreviewScrollPane.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { // boolean useScrollBar = useScrollBarOption.isSelected(); GuiUtil.initialiseTableColumnWidths(dataPreviewTable, true); } }); Box top = Box.createHorizontalBox(); top.add(new JLabel("# rows to preview: ")); top.add(new JSpinner(previewRowCountSpinnerModel)); top.add(Box.createHorizontalGlue()); top.add(useScrollBarOption); JPanel dataPreviewPanel = new JPanel(new BorderLayout()); dataPreviewPanel.add(GuiUtil.createLabelSeparator("Data Preview", top), BorderLayout.NORTH); dataPreviewPanel.add(dataPreviewScrollPane, BorderLayout.CENTER); headingWarning.setForeground(Color.RED); JLabel instructions = new JLabel("<HTML>Please assign a <i>Role</i> for each of the headings in your data" + "<br>You must specify one as the <i>Entry Name</i>." + "<br>Click on one of the <i>Role</i> cells and select from the dropdown" + "<br>To assign multiple headings, select the rows for which you wish" + "<br>to set the <i>Role</i> then right-click and choose from the dropdown."); instructions.setHorizontalAlignment(JLabel.CENTER); instructions.setBackground(Toast.PALE_YELLOW); JScrollPane instScroll = new JScrollPane(instructions); instScroll.setBackground(Toast.PALE_YELLOW); normalEntryNameField.getDocument() .addDocumentListener(new DocumentChangeListener((e) -> updateAcceptButton())); normalEntryNameField.setText(TrialDesignPreferences.getInstance().getNormalEntryTypeName()); JPanel rolesPanel = new JPanel(); GBH gbh = new GBH(rolesPanel, 2, 2, 0, 0); int y = 0; gbh.add(0, y, 1, 1, GBH.NONE, 0, 1, GBH.EAST, "Entry Type Name for non-Checks:"); gbh.add(1, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, normalEntryNameField); gbh.add(2, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, saveForFuture); ++y; gbh.add(0, y, 3, 1, GBH.BOTH, 2, 1, GBH.CENTER, roleAssignmentPanel); ++y; JSplitPane headingsAndInstructions = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, rolesPanel, instScroll); JPanel headingPanel = new JPanel(new BorderLayout()); headingPanel.add(GuiUtil.createLabelSeparator("Assign Roles for Headings"), BorderLayout.NORTH); headingPanel.add(headingsAndInstructions, BorderLayout.CENTER); headingPanel.add(headingWarning, BorderLayout.SOUTH); errorMessage.setEditable(false); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dataPreviewPanel, headingPanel); splitPane.setResizeWeight(0.5); cardPanel.add(new JScrollPane(errorMessage), CARD_ERROR); cardPanel.add(splitPane, CARD_DATA); Box bot = Box.createHorizontalBox(); bot.add(Box.createHorizontalGlue()); bot.add(new JButton(cancelAction)); bot.add(new JButton(acceptAction)); acceptAction.setEnabled(false); Container cp = getContentPane(); cp.add(cardPanel, BorderLayout.CENTER); cp.add(bot, BorderLayout.SOUTH); pack(); sheetNamesComboBox.addActionListener(sheetNamesActionListener); Timer timer = new Timer(true); previewRowCountSpinnerModel.addChangeListener(new ChangeListener() { int nPreview; TimerTask timerTask = null; @Override public void stateChanged(ChangeEvent e) { nPreview = previewRowCountSpinnerModel.getNumber().intValue(); if (timerTask == null) { timerTask = new TimerTask() { int lastPreviewCount = nPreview; @Override public void run() { if (lastPreviewCount == nPreview) { System.err.println("Stable at " + lastPreviewCount); // No change, do it now cancel(); try { updateDataPreview(lastPreviewCount); } finally { timerTask = null; } } else { System.err.println("Changing from " + lastPreviewCount + " to " + nPreview); lastPreviewCount = nPreview; } } }; timer.scheduleAtFixedRate(timerTask, 500, 100); } } }); sheetNamesComboBox.setVisible(false); addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { removeWindowListener(this); setFile(inputFile); } }); }
From source file:fr.free.hd.servers.gui.FaceView.java
private JPanel createKind() { JPanel panel = new JPanel(new GridLayout(3, 0)); final JSlider sliderX = new JSlider(); final JSlider sliderY = new JSlider(); final JComboBox box = new JComboBox(HandKeyEnum.values()); sliderX.setMinimum(-1000);/*from w w w . j a v a 2 s .c om*/ sliderX.setMaximum(1000); sliderX.setMajorTickSpacing(100); sliderX.setPaintLabels(true); sliderX.setPaintTicks(true); sliderX.setPaintTrack(true); sliderY.setMinimum(-1000); sliderY.setMaximum(1000); sliderY.setMajorTickSpacing(100); sliderY.setPaintLabels(true); sliderY.setPaintTicks(true); sliderY.setPaintTrack(true); box.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { kind = (HandKeyEnum) e.getItem(); updateLabel(); } }); panel.add(box); sliderX.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { switch (kind) { case HAND_KEY_2D: face.setAnchorX_2D(sliderX.getValue()); break; case HAND_KEY_2M: face.setAnchorX_2M(sliderX.getValue()); break; case HAND_KEY_1M: face.setAnchorX_1M(sliderX.getValue()); break; case HAND_KEY_2V: face.setAnchorX_2V(sliderX.getValue()); break; case HAND_KEY_3D: face.setAnchorX_3D(sliderX.getValue()); break; case HAND_KEY_3G: face.setAnchorX_3G(sliderX.getValue()); break; case HAND_KEY_4G: face.setAnchorX_4G(sliderX.getValue()); break; case HAND_KEY_5M: face.setAnchorX_5M(sliderX.getValue()); break; } updateLabel(); } }); sliderY.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { switch (kind) { case HAND_KEY_2D: face.setAnchorY_2D(sliderY.getValue()); break; case HAND_KEY_2M: face.setAnchorY_2M(sliderY.getValue()); break; case HAND_KEY_1M: face.setAnchorY_1M(sliderY.getValue()); break; case HAND_KEY_2V: face.setAnchorY_2V(sliderY.getValue()); break; case HAND_KEY_3D: face.setAnchorY_3D(sliderY.getValue()); break; case HAND_KEY_3G: face.setAnchorY_3G(sliderY.getValue()); break; case HAND_KEY_4G: face.setAnchorY_4G(sliderY.getValue()); break; case HAND_KEY_5M: face.setAnchorY_5M(sliderY.getValue()); break; } updateLabel(); } }); panel.add(sliderX); panel.add(sliderY); return panel; }
From source file:com.diversityarrays.kdxplore.KDXploreFrame.java
KDXploreFrame(ApplicationFolder appFolder, String title, int versionCode, String version, Closure<UpdateCheckContext> updateChecker) throws IOException { super(title); this.applicationFolder = appFolder; this.baseTitle = title; this.versionCode = versionCode; this.version = version; this.updateChecker = updateChecker; KdxploreConfig config = KdxploreConfig.getInstance(); this.onlineHelpUrl = config.getOnlineHelpUrl(); String supportEmail = config.getSupportEmail(); if (Check.isEmpty(supportEmail)) { supportEmail = "someone@somewhere"; //$NON-NLS-1$ }//from ww w .j a v a2 s . co m DefaultUncaughtExceptionHandler eh = new DefaultUncaughtExceptionHandler(this, appFolder.getApplicationName() + "_Error", //$NON-NLS-1$ supportEmail, version + "(" + versionCode + ")"); //$NON-NLS-1$ //$NON-NLS-2$ Thread.setDefaultUncaughtExceptionHandler(eh); MsgBox.DEFAULT_PROBLEM_REPORTER = eh; this.userDataFolder = applicationFolder.getUserDataFolder(); this.loginUrlsProvider = new PropertiesLoginUrlsProvider(CommandArgs.getPropertiesFile(applicationFolder)); displayVersion = RunMode.getRunMode().isDeveloper() ? version + "-dev" //$NON-NLS-1$ : version; List<? extends Image> iconImages = loadIconImages(); iconImage = iconImageBig != null ? iconImageBig : iconImageSmall; kdxploreIcon = new ImageIcon(iconImageSmall != null ? iconImageSmall : iconImageBig); setIconImages(iconImages); if (Util.isMacOS()) { try { System.setProperty("apple.laf.useScreenMenuBar", "true"); //$NON-NLS-1$ //$NON-NLS-2$ macapp = new MacApplication(null); macapp.setAboutHandler(aboutAction); macapp.setQuitHandler(exitAction); if (iconImage != null) { macapp.setDockIconImage(iconImage); } macapp.setPreferencesHandler(settingsAction); macapp.setAboutHandler(aboutAction); macapp.setQuitHandler(exitAction); } catch (MacApplicationException e) { macapp = null; Shared.Log.w(TAG, "isMacOS", e); //$NON-NLS-1$ } } if (iconImage != null) { this.setIconImage(iconImage); } clientProvider = new DefaultDALClientProvider(this, loginUrlsProvider, createBrandingImageComponent()); clientProvider.setCanChangeUrl(false); clientProvider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { handleClientChanged(); } }); connectDisconnectActions = new ConnectDisconnectActions(clientProvider, Msg.TOOLTIP_CONNECT_TO_DATABASE(), Msg.TOOLTIP_DISCONNECT_FROM_DATABASE()); connectDisconnectActions.setConnectIntercept(connectIntercept); desktopSupport = new DefaultDesktopSupport(KDXploreFrame.this, baseTitle); frameWindowOpener = new DefaultFrameWindowOpener(desktopSupport) { @Override public Image getIconImage() { return iconImage; } }; frameWindowOpener.setOpenOnSameScreenAs(KDXploreFrame.this); setGlassPane(desktopSupport.getBlockingPane()); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(windowListener); initialiseKdxApps(); JMenuBar mb = buildMenuBar(); if (iconImage != null) { backgroundPanel.setBackgroundImage(iconImage); } else { backgroundPanel.setBackgroundImage(KDClientUtils.getImage(ImageId.DART_LOGO_128x87)); } backgroundPanel.setBackground(Color.decode("0xccffff")); //$NON-NLS-1$ splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cardPanel, messagesPanel); splitPane.setResizeWeight(0.8); // = = = = = = Container cp = getContentPane(); cp.add(splitPane, BorderLayout.CENTER); statusInfoLine.setHorizontalAlignment(SwingConstants.LEFT); logoImagesLabel = new LogoImagesLabel(); JPanel bottom = new JPanel(new BorderLayout()); bottom.add(statusInfoLine, BorderLayout.CENTER); bottom.add(logoImagesLabel, BorderLayout.EAST); cp.add(bottom, BorderLayout.SOUTH); addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { removeWindowListener(this); logoImagesLabel.startCycling(); } }); showCard(CARD_KDXAPPS); setJMenuBar(mb); pack(); Dimension size = getSize(); boolean changed = false; if (size.width < MINIMUM_SIZE.width) { size.width = MINIMUM_SIZE.width; changed = true; } if (size.height < MINIMUM_SIZE.height) { size.height = MINIMUM_SIZE.height; changed = true; } if (changed) { setSize(size); } setLocationRelativeTo(null); final MemoryUsageMonitor mum = new MemoryUsageMonitor(); mum.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { updateStatusLineWithMemoryUsage(mum.getMemoryUsage()); } }); }