List of usage examples for javax.swing JButton setOpaque
@BeanProperty(expert = true, description = "The component's opacity") public void setOpaque(boolean isOpaque)
From source file:org.eobjects.datacleaner.panels.OpenAnalysisJobPanel.java
public OpenAnalysisJobPanel(final FileObject file, final AnalyzerBeansConfiguration configuration, final OpenAnalysisJobActionListener openAnalysisJobActionListener) { super(WidgetUtils.BG_COLOR_LESS_BRIGHT, WidgetUtils.BG_COLOR_LESS_BRIGHT); _file = file;// w w w.ja v a2 s .c o m _openAnalysisJobActionListener = openAnalysisJobActionListener; setLayout(new BorderLayout()); setBorder(WidgetUtils.BORDER_LIST_ITEM); final AnalysisJobMetadata metadata = getMetadata(configuration); final String jobName = metadata.getJobName(); final String jobDescription = metadata.getJobDescription(); final String datastoreName = metadata.getDatastoreName(); final boolean isDemoJob = isDemoJob(metadata); final DCPanel labelListPanel = new DCPanel(); labelListPanel.setLayout(new VerticalLayout(4)); labelListPanel.setBorder(new EmptyBorder(4, 4, 4, 0)); final String title; final String filename = file.getName().getBaseName(); if (Strings.isNullOrEmpty(jobName)) { final String extension = FileFilters.ANALYSIS_XML.getExtension(); if (filename.toLowerCase().endsWith(extension)) { title = filename.substring(0, filename.length() - extension.length()); } else { title = filename; } } else { title = jobName; } final JButton titleButton = new JButton(title); titleButton.setFont(WidgetUtils.FONT_HEADER1); titleButton.setForeground(WidgetUtils.BG_COLOR_BLUE_MEDIUM); titleButton.setHorizontalAlignment(SwingConstants.LEFT); titleButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, WidgetUtils.BG_COLOR_MEDIUM)); titleButton.setToolTipText("Open job"); titleButton.setOpaque(false); titleButton.setMargin(new Insets(0, 0, 0, 0)); titleButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); titleButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isDemoDatastoreConfigured(datastoreName, configuration)) { _openAnalysisJobActionListener.openFile(_file); } } }); final JButton executeButton = new JButton(executeIcon); executeButton.setOpaque(false); executeButton.setToolTipText("Execute job directly"); executeButton.setMargin(new Insets(0, 0, 0, 0)); executeButton.setBorderPainted(false); executeButton.setHorizontalAlignment(SwingConstants.RIGHT); executeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isDemoDatastoreConfigured(datastoreName, configuration)) { final ImageIcon executeIconLarge = ImageManager.get().getImageIcon(IconUtils.ACTION_EXECUTE); final String question = "Are you sure you want to execute the job\n'" + title + "'?"; final int choice = JOptionPane.showConfirmDialog(null, question, "Execute job?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, executeIconLarge); if (choice == JOptionPane.YES_OPTION) { final Injector injector = _openAnalysisJobActionListener.openAnalysisJob(_file); if (injector != null) { final ResultWindow resultWindow = injector.getInstance(ResultWindow.class); resultWindow.open(); resultWindow.startAnalysis(); } } } } }); final DCPanel titlePanel = new DCPanel(); titlePanel.setLayout(new BorderLayout()); titlePanel.add(DCPanel.around(titleButton), BorderLayout.CENTER); titlePanel.add(executeButton, BorderLayout.EAST); labelListPanel.add(titlePanel); if (!Strings.isNullOrEmpty(jobDescription)) { String desc = StringUtils.replaceWhitespaces(jobDescription, " "); desc = StringUtils.replaceAll(desc, " ", " "); final JLabel label = new JLabel(desc); label.setFont(WidgetUtils.FONT_SMALL); labelListPanel.add(label); } final Icon icon; { if (!StringUtils.isNullOrEmpty(datastoreName)) { final JLabel label = new JLabel(" " + datastoreName); label.setFont(WidgetUtils.FONT_SMALL); labelListPanel.add(label); final Datastore datastore = configuration.getDatastoreCatalog().getDatastore(datastoreName); if (isDemoJob) { icon = demoBadgeIcon; } else { icon = IconUtils.getDatastoreSpecificAnalysisJobIcon(datastore); } } else { icon = ImageManager.get().getImageIcon(IconUtils.MODEL_JOB, IconUtils.ICON_SIZE_LARGE); } } final JLabel iconLabel = new JLabel(icon); iconLabel.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); add(iconLabel, BorderLayout.WEST); add(labelListPanel, BorderLayout.CENTER); }
From source file:org.openconcerto.erp.core.finance.accounting.ui.EtatJournauxPanel.java
private JPanel creerJournalMoisPanel(final Date date, long debit, long credit, final Journal jrnl) { final JPanel panelMoisCompte = new JPanel(); panelMoisCompte.setLayout(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(2, 2, 1, 2); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHWEST; c.gridx = 0;//from ww w. j ava2s . c o m c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 1; c.weighty = 0; panelMoisCompte.setBorder(BorderFactory.createTitledBorder(dateFormat.format(date))); // Date du mois panelMoisCompte.add(new JLabel(dateFormat.format(date)), c); // Totaux du mois c.gridx++; panelMoisCompte.add(new JLabel(" dbit : " + GestionDevise.currencyToString(debit)), c); c.gridx++; panelMoisCompte.add(new JLabel(" crdit : " + GestionDevise.currencyToString(credit)), c); // Bouton dtails JButton boutonShow = new JButton("+/-"); boutonShow.setOpaque(false); boutonShow.setHorizontalAlignment(SwingConstants.LEFT); c.weightx = 0; c.gridx++; panelMoisCompte.add(boutonShow, c); boutonShow.addActionListener(new ActionListener() { private boolean isShow = false; private ListPanelEcritures listEcriture; public void actionPerformed(ActionEvent e) { System.err.println(this.isShow); // Afficher la JTable du compte if (!this.isShow) { final SQLElement element = Configuration.getInstance().getDirectory().getElement("ECRITURE"); final SQLTable ecrTable = element.getTable(); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.DATE, 1); Date inf = cal.getTime(); cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DATE)); Date sup = cal.getTime(); System.out.println("Inf : " + inf + " Sup : " + sup); Where w = new Where(ecrTable.getField("ID_JOURNAL"), "=", jrnl.getId()); Where w2 = new Where(ecrTable.getField("DATE"), inf, sup); if (!UserManager.getInstance().getCurrentUser().getRights() .haveRight(ComptaUserRight.ACCES_NOT_RESCTRICTED_TO_411)) { // TODO Show Restricted acces in UI w = w.and(new Where(ecrTable.getField("COMPTE_NUMERO"), "LIKE", "411%")); } this.listEcriture = new ListPanelEcritures(element, w.and(w2)); this.listEcriture.setModificationVisible(false); this.listEcriture.setAjoutVisible(false); this.listEcriture.setSuppressionVisible(false); this.listEcriture.getListe().setSQLEditable(false); Dimension d; // Taille limite 200 maximum if (this.listEcriture.getListe().getPreferredSize().height > 200) { d = new Dimension(this.listEcriture.getListe().getPreferredSize().width, 200); } else { d = new Dimension(this.listEcriture.getListe().getPreferredSize().width, this.listEcriture.getListe().getPreferredSize().height + 30); } this.listEcriture.getListe().setPreferredSize(d); // c.gridy = 2; c.gridx = 0; c.gridy = 1; c.gridwidth = 4; c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; this.listEcriture.getListe().setSQLEditable(false); panelMoisCompte.add(this.listEcriture, c); this.listEcriture.getListe().getJTable().addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { JPopupMenu menu = new JPopupMenu(); menu.add(new AbstractAction("Voir la source") { public void actionPerformed(ActionEvent e) { SQLRow row = base.getTable("ECRITURE") .getRow(listEcriture.getListe().getSelectedId()); MouvementSQLElement.showSource(row.getInt("ID_MOUVEMENT")); } }); menu.show(e.getComponent(), e.getPoint().x, e.getPoint().y); } } }); } else { panelMoisCompte.remove(this.listEcriture); System.out.println("Hide ListEcriture"); panelMoisCompte.repaint(); panelMoisCompte.revalidate(); } this.isShow = !this.isShow; SwingUtilities.getRoot(panelMoisCompte).repaint(); } }); return panelMoisCompte; }
From source file:org.openconcerto.erp.core.finance.accounting.ui.GrandLivrePanel.java
private JPanel creerComptePanel(final Compte compte) { final GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(2, 2, 1, 2); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTHWEST; c.gridx = GridBagConstraints.RELATIVE; c.gridy = 0;/* ww w. java 2 s .c om*/ c.gridwidth = 1; c.gridheight = 1; c.weightx = 1; c.weighty = 0; // Intitul du compte final JPanel panelCompte = new JPanel(); panelCompte.setOpaque(false); panelCompte.setLayout(new GridBagLayout()); panelCompte.setBorder(BorderFactory.createTitledBorder(compte.getNumero() + " " + compte.getNom())); // Bouton Dtails +/- du compte JButton boutonShow = new JButton("+/-"); boutonShow.setOpaque(false); boutonShow.setHorizontalAlignment(SwingConstants.RIGHT); // Total du Compte JLabel labelCompteDebit = new JLabel( "Total Debit : " + GestionDevise.currencyToString(compte.getTotalDebit())); JLabel labelCompteCredit = new JLabel( " Credit : " + GestionDevise.currencyToString(compte.getTotalCredit())); // labelCompte.setFont(new Font(labelCompte.getFont().getFontName(), Font.BOLD, 12)); labelCompteDebit.setHorizontalAlignment(SwingUtilities.LEFT); labelCompteCredit.setHorizontalAlignment(SwingUtilities.LEFT); JLabel labelTmp = new JLabel(compte.getNumero() + " " + compte.getNom()); labelTmp.setHorizontalAlignment(SwingUtilities.LEFT); panelCompte.add(labelTmp, c); panelCompte.add(labelCompteDebit, c); panelCompte.add(labelCompteCredit, c); c.weightx = 1; c.anchor = GridBagConstraints.NORTHEAST; panelCompte.add(boutonShow, c); boutonShow.addActionListener(new ActionListener() { private boolean isShow = false; private JScrollPane scroll = null; public void actionPerformed(ActionEvent e) { System.err.println(this.isShow); // Afficher la JTable du compte if (!this.isShow) { // if (this.scroll == null) { System.err.println(compte); JTable tableCpt = createJTableCompte(compte); this.scroll = new JScrollPane(tableCpt); // calcul de la taille du JScrollPane Dimension d; System.err.println(tableCpt); if (tableCpt.getPreferredSize().height > 200) { d = new Dimension(this.scroll.getPreferredSize().width, 200); } else { d = new Dimension(this.scroll.getPreferredSize().width, tableCpt.getPreferredSize().height + 30); } this.scroll.setPreferredSize(d); c.gridy++; c.gridwidth = 4; c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHWEST; panelCompte.add(this.scroll, c); /* * } else { this.scroll.setVisible(true); } */ } else { // if (this.scroll != null) { panelCompte.remove(this.scroll); System.out.println("Hide scrollPane"); // this.scroll.setVisible(false); // this.scroll.repaint(); panelCompte.repaint(); panelCompte.revalidate(); // } } this.isShow = !this.isShow; SwingUtilities.getRoot(panelCompte).repaint(); } }); return panelCompte; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java
/** * Formats the specified button.// w ww .java2 s . c o m * * @param button The button to handle. * @param text The tool tip text. * @param actionID The action command id. */ private void formatButton(JButton button, String text, int actionID) { button.setOpaque(false); UIUtilities.unifiedButtonLookAndFeel(button); button.setBackground(UIUtilities.BACKGROUND_COLOR); button.setToolTipText(text); button.addActionListener(this); button.setActionCommand("" + actionID); }
From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptingDialog.java
/** * Creates a button./*from w w w .j a va 2 s . co m*/ * * @param text The text of the button. * @param actionID The action command id. * @return See above. */ private JButton createButton(String text, int actionID) { JButton b = new JButton(text); b.setActionCommand("" + actionID); b.addActionListener(this); b.setOpaque(false); UIUtilities.unifiedButtonLookAndFeel(b); return b; }
From source file:org.openmicroscopy.shoola.util.ui.MessengerDialog.java
/** * Formats the specified button./* ww w .ja v a 2s . c om*/ * * @param b The button to format. * @param mnemonic The key-code that indicates a mnemonic key. * @param tooltip The button's tooltip. * @param actionID The action id associated to the passed button. */ private void formatButton(JButton b, int mnemonic, String tooltip, int actionID) { b.setMnemonic(mnemonic); b.setOpaque(false); b.setToolTipText(tooltip); b.addActionListener(this); b.setActionCommand("" + actionID); }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Creates a button looking like an hyper-link. * // w ww .j ava 2 s . c om * @param text The text to display * @return See above. */ public static JButton createHyperLinkButton(String text) { if (text == null || text.trim().length() == 0) text = "hyperlink"; JButton b = new JButton(text); Font f = b.getFont(); b.setFont(f.deriveFont(f.getStyle(), f.getSize() - 2)); b.setOpaque(false); b.setForeground(UIUtilities.HYPERLINK_COLOR); unifiedButtonLookAndFeel(b); return b; }
From source file:org.processmining.analysis.performance.fsmanalysis.FSMPerformanceAnalysisUI.java
public void initGraphMenu() { splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setDividerSize(0);/*from w ww.j a v a 2 s . com*/ initTimeSort(); menuPanel.add(timeUnitSort.getPropertyPanel()); initMeasureSort(); menuPanel.add(measureSort.getPropertyPanel()); initColorBySort(); menuPanel.add(colorBySort.getPropertyPanel()); menuPanel.add(min.getPropertyPanel()); menuPanel.add(max.getPropertyPanel()); JButton updateButton = new AutoFocusButton("Update"); updateButton.setOpaque(false); updateButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { updateGUI(); restoreAcceptFSM(); } }); menuPanel.add(updateButton); mainPanel.setBackground(colorBg); menuPanel.setBackground(colorBg); chartPanel.setBackground(colorBg); splitPane.setBackground(colorBg); chartPanel.setLayout(new BorderLayout()); overallMax = 0.0; for (DescriptiveStatistics ds : getTimeMap().values()) { if (overallMax < getData(ds)) overallMax = getData(ds); } overallEdgeMax = 0.0; for (DescriptiveStatistics ds : edgeInterMap.values()) { if (overallEdgeMax < getData(ds)) overallEdgeMax = getData(ds); } findCriticalPath(); adjustTimeScale(); chartPanel.add(acceptFSM.getGrappaVisualization(), BorderLayout.CENTER); restoreAcceptFSM(); splitPane.setLeftComponent(menuPanel); splitPane.setRightComponent(chartPanel); }
From source file:org.processmining.analysis.performance.fsmevaluator.FSMEvaluationAnalysisUI.java
public void initGraphMenu() { splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setDividerSize(0);// ww w . j av a 2 s . co m initColorBySort(); menuPanel.add(colorBySort.getPropertyPanel()); menuPanel.add(min.getPropertyPanel()); menuPanel.add(max.getPropertyPanel()); JButton updateButton = new AutoFocusButton("Update"); updateButton.setOpaque(false); updateButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { updateGUI(); } }); menuPanel.add(updateButton); mainPanel.setBackground(colorBg); menuPanel.setBackground(colorBg); chartPanel.setBackground(colorBg); splitPane.setBackground(colorBg); chartPanel.setLayout(new BorderLayout()); overallMax = 0.0; for (DescriptiveStatistics ds : getTimeMap().values()) { if (overallMax < ds.getSum()) overallMax = ds.getSum(); } adjustTimeScale(); chartPanel.add(acceptFSM.getGrappaVisualization(), BorderLayout.CENTER); splitPane.setLeftComponent(menuPanel); splitPane.setRightComponent(chartPanel); }
From source file:org.ut.biolab.medsavant.client.cohort.CohortDetailedView.java
private JButton removeIndividualsButton() { JButton button = ViewUtil.getSoftButton("Remove selected member"); button.setBackground(ViewUtil.getDetailsBackgroundColor()); button.setOpaque(false); button.addActionListener(new ActionListener() { @Override/*from w w w . jav a 2 s .c om*/ public void actionPerformed(ActionEvent e) { int[] rows = list.getSelectedRows(); int[] patientIDs = new int[rows.length]; for (int i = 0; i < rows.length; i++) { patientIDs[i] = ((SimplePatient) list.getModel().getValueAt(rows[i], 0)).getId(); } if (patientIDs != null && patientIDs.length > 0) { if (DialogUtils.askYesNo("Confirm", "Are you sure you want to remove these individual(s)?") == DialogUtils.NO) { return; } try { MedSavantClient.CohortManager.removePatientsFromCohort(LoginController.getSessionID(), patientIDs, cohorts[0].getId()); } catch (Exception ex) { LOG.error("Error removing patients from cohort.", ex); } worker = new CohortDetailsWorker(cohorts[0]); worker.execute(); } } }); return button; }