List of usage examples for javax.swing JTextArea setBackground
@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.") public void setBackground(Color bg)
From source file:edu.ucla.stat.SOCR.chart.Chart.java
/** * make the content of the popup dialog highlightable * @param m/*from w w w . j av a 2 s . c om*/ */ public void showMessageDialog(String m) { JOptionPane popup = new JOptionPane(); JTextArea msg = new JTextArea(m); Color bg = popup.getBackground(); msg.setBackground(bg); popup.showMessageDialog(this, msg); }
From source file:net.pms.encoders.MEncoderVideo.java
@Override public JComponent config() { // Apply the orientation for the locale Locale locale = new Locale(configuration.getLanguage()); ComponentOrientation orientation = ComponentOrientation.getOrientation(locale); String colSpec = FormLayoutUtil.getColSpec(COL_SPEC, orientation); FormLayout layout = new FormLayout(colSpec, ROW_SPEC); PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(Borders.EMPTY_BORDER); builder.setOpaque(false);// w ww . j a va2 s. c o m CellConstraints cc = new CellConstraints(); checkBox = new JCheckBox(Messages.getString("MEncoderVideo.0")); checkBox.setContentAreaFilled(false); if (configuration.getSkipLoopFilterEnabled()) { checkBox.setSelected(true); } checkBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setSkipLoopFilterEnabled((e.getStateChange() == ItemEvent.SELECTED)); } }); JComponent cmp = builder.addSeparator(Messages.getString("NetworkTab.5"), FormLayoutUtil.flip(cc.xyw(1, 1, 15), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); mencodermt = new JCheckBox(Messages.getString("MEncoderVideo.35")); mencodermt.setContentAreaFilled(false); if (configuration.getMencoderMT()) { mencodermt.setSelected(true); } mencodermt.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { configuration.setMencoderMT(mencodermt.isSelected()); } }); mencodermt.setEnabled(Platform.isWindows() || Platform.isMac()); builder.add(mencodermt, FormLayoutUtil.flip(cc.xy(1, 3), colSpec, orientation)); builder.add(checkBox, FormLayoutUtil.flip(cc.xyw(3, 3, 12), colSpec, orientation)); noskip = new JCheckBox(Messages.getString("MEncoderVideo.2")); noskip.setContentAreaFilled(false); if (configuration.isMencoderNoOutOfSync()) { noskip.setSelected(true); } noskip.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderNoOutOfSync((e.getStateChange() == ItemEvent.SELECTED)); } }); builder.add(noskip, FormLayoutUtil.flip(cc.xy(1, 5), colSpec, orientation)); JButton button = new JButton(Messages.getString("MEncoderVideo.29")); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JPanel codecPanel = new JPanel(new BorderLayout()); final JTextArea textArea = new JTextArea(); textArea.setText(configuration.getMencoderCodecSpecificConfig()); textArea.setFont(new Font("Courier", Font.PLAIN, 12)); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setPreferredSize(new java.awt.Dimension(900, 100)); final JTextArea textAreaDefault = new JTextArea(); textAreaDefault.setText(DEFAULT_CODEC_CONF_SCRIPT); textAreaDefault.setBackground(Color.WHITE); textAreaDefault.setFont(new Font("Courier", Font.PLAIN, 12)); textAreaDefault.setEditable(false); textAreaDefault.setEnabled(configuration.isMencoderIntelligentSync()); JScrollPane scrollPaneDefault = new JScrollPane(textAreaDefault); scrollPaneDefault.setPreferredSize(new java.awt.Dimension(900, 450)); JPanel customPanel = new JPanel(new BorderLayout()); intelligentsync = new JCheckBox(Messages.getString("MEncoderVideo.3")); intelligentsync.setContentAreaFilled(false); if (configuration.isMencoderIntelligentSync()) { intelligentsync.setSelected(true); } intelligentsync.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderIntelligentSync((e.getStateChange() == ItemEvent.SELECTED)); textAreaDefault.setEnabled(configuration.isMencoderIntelligentSync()); } }); JLabel label = new JLabel(Messages.getString("MEncoderVideo.33")); customPanel.add(label, BorderLayout.NORTH); customPanel.add(scrollPane, BorderLayout.SOUTH); codecPanel.add(intelligentsync, BorderLayout.NORTH); codecPanel.add(scrollPaneDefault, BorderLayout.CENTER); codecPanel.add(customPanel, BorderLayout.SOUTH); while (JOptionPane.showOptionDialog( SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame()), codecPanel, Messages.getString("MEncoderVideo.34"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null) == JOptionPane.OK_OPTION) { String newCodecparam = textArea.getText(); DLNAMediaInfo fakemedia = new DLNAMediaInfo(); DLNAMediaAudio audio = new DLNAMediaAudio(); audio.setCodecA("ac3"); fakemedia.setCodecV("mpeg4"); fakemedia.setContainer("matroska"); fakemedia.setDuration(45d * 60); audio.getAudioProperties().setNumberOfChannels(2); fakemedia.setWidth(1280); fakemedia.setHeight(720); audio.setSampleFrequency("48000"); fakemedia.setFrameRate("23.976"); fakemedia.getAudioTracksList().add(audio); String result[] = getSpecificCodecOptions(newCodecparam, fakemedia, new OutputParams(configuration), "dummy.mpg", "dummy.srt", false, true); if (result.length > 0 && result[0].startsWith("@@")) { String errorMessage = result[0].substring(2); JOptionPane.showMessageDialog( SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame()), errorMessage, Messages.getString("Dialog.Error"), JOptionPane.ERROR_MESSAGE); } else { configuration.setMencoderCodecSpecificConfig(newCodecparam); break; } } } }); builder.add(button, FormLayoutUtil.flip(cc.xy(1, 11), colSpec, orientation)); forcefps = new JCheckBox(Messages.getString("MEncoderVideo.4")); forcefps.setContentAreaFilled(false); if (configuration.isMencoderForceFps()) { forcefps.setSelected(true); } forcefps.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderForceFps(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(forcefps, FormLayoutUtil.flip(cc.xyw(1, 7, 2), colSpec, orientation)); yadif = new JCheckBox(Messages.getString("MEncoderVideo.26")); yadif.setContentAreaFilled(false); if (configuration.isMencoderYadif()) { yadif.setSelected(true); } yadif.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderYadif(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(yadif, FormLayoutUtil.flip(cc.xyw(3, 7, 7), colSpec, orientation)); scaler = new JCheckBox(Messages.getString("MEncoderVideo.27")); scaler.setContentAreaFilled(false); scaler.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderScaler(e.getStateChange() == ItemEvent.SELECTED); scaleX.setEnabled(configuration.isMencoderScaler()); scaleY.setEnabled(configuration.isMencoderScaler()); } }); builder.add(scaler, FormLayoutUtil.flip(cc.xyw(3, 5, 7), colSpec, orientation)); builder.addLabel(Messages.getString("MEncoderVideo.28"), FormLayoutUtil .flip(cc.xy(9, 5, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation)); scaleX = new JTextField("" + configuration.getMencoderScaleX()); scaleX.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { try { configuration.setMencoderScaleX(Integer.parseInt(scaleX.getText())); } catch (NumberFormatException nfe) { logger.debug("Could not parse scaleX from \"" + scaleX.getText() + "\""); } } }); builder.add(scaleX, FormLayoutUtil.flip(cc.xy(11, 5), colSpec, orientation)); builder.addLabel(Messages.getString("MEncoderVideo.30"), FormLayoutUtil .flip(cc.xy(13, 5, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation)); scaleY = new JTextField("" + configuration.getMencoderScaleY()); scaleY.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { try { configuration.setMencoderScaleY(Integer.parseInt(scaleY.getText())); } catch (NumberFormatException nfe) { logger.debug("Could not parse scaleY from \"" + scaleY.getText() + "\""); } } }); builder.add(scaleY, FormLayoutUtil.flip(cc.xy(15, 5), colSpec, orientation)); if (configuration.isMencoderScaler()) { scaler.setSelected(true); } else { scaleX.setEnabled(false); scaleY.setEnabled(false); } builder.addLabel(Messages.getString("MEncoderVideo.6"), FormLayoutUtil.flip(cc.xy(1, 13), colSpec, orientation)); mencoder_custom_options = new JTextField(configuration.getMencoderCustomOptions()); mencoder_custom_options.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderCustomOptions(mencoder_custom_options.getText()); } }); builder.add(mencoder_custom_options, FormLayoutUtil.flip(cc.xyw(3, 13, 13), colSpec, orientation)); builder.addLabel(Messages.getString("MEncoderVideo.93"), FormLayoutUtil.flip(cc.xy(1, 15), colSpec, orientation)); builder.addLabel(Messages.getString("MEncoderVideo.28") + " (%)", FormLayoutUtil .flip(cc.xy(1, 15, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation)); ocw = new JTextField(configuration.getMencoderOverscanCompensationWidth()); ocw.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderOverscanCompensationWidth(ocw.getText()); } }); builder.add(ocw, FormLayoutUtil.flip(cc.xy(3, 15), colSpec, orientation)); builder.addLabel(Messages.getString("MEncoderVideo.30") + " (%)", FormLayoutUtil.flip(cc.xy(5, 15), colSpec, orientation)); och = new JTextField(configuration.getMencoderOverscanCompensationHeight()); och.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderOverscanCompensationHeight(och.getText()); } }); builder.add(och, FormLayoutUtil.flip(cc.xy(7, 15), colSpec, orientation)); cmp = builder.addSeparator(Messages.getString("MEncoderVideo.8"), FormLayoutUtil.flip(cc.xyw(1, 17, 15), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); builder.addLabel(Messages.getString("MEncoderVideo.16"), FormLayoutUtil .flip(cc.xy(1, 27, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation)); mencoder_noass_scale = new JTextField(configuration.getMencoderNoAssScale()); mencoder_noass_scale.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderNoAssScale(mencoder_noass_scale.getText()); } }); builder.addLabel(Messages.getString("MEncoderVideo.17"), FormLayoutUtil.flip(cc.xy(5, 27), colSpec, orientation)); mencoder_noass_outline = new JTextField(configuration.getMencoderNoAssOutline()); mencoder_noass_outline.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderNoAssOutline(mencoder_noass_outline.getText()); } }); builder.addLabel(Messages.getString("MEncoderVideo.18"), FormLayoutUtil.flip(cc.xy(9, 27), colSpec, orientation)); mencoder_noass_blur = new JTextField(configuration.getMencoderNoAssBlur()); mencoder_noass_blur.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderNoAssBlur(mencoder_noass_blur.getText()); } }); builder.addLabel(Messages.getString("MEncoderVideo.19"), FormLayoutUtil.flip(cc.xy(13, 27), colSpec, orientation)); mencoder_noass_subpos = new JTextField(configuration.getMencoderNoAssSubPos()); mencoder_noass_subpos.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderNoAssSubPos(mencoder_noass_subpos.getText()); } }); builder.add(mencoder_noass_scale, FormLayoutUtil.flip(cc.xy(3, 27), colSpec, orientation)); builder.add(mencoder_noass_outline, FormLayoutUtil.flip(cc.xy(7, 27), colSpec, orientation)); builder.add(mencoder_noass_blur, FormLayoutUtil.flip(cc.xy(11, 27), colSpec, orientation)); builder.add(mencoder_noass_subpos, FormLayoutUtil.flip(cc.xy(15, 27), colSpec, orientation)); ass = new JCheckBox(Messages.getString("MEncoderVideo.20")); ass.setContentAreaFilled(false); ass.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e != null) { configuration.setMencoderAss(e.getStateChange() == ItemEvent.SELECTED); } } }); builder.add(ass, FormLayoutUtil.flip(cc.xy(1, 23), colSpec, orientation)); ass.setSelected(configuration.isMencoderAss()); ass.getItemListeners()[0].itemStateChanged(null); fc = new JCheckBox(Messages.getString("MEncoderVideo.21")); fc.setContentAreaFilled(false); fc.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderFontConfig(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(fc, FormLayoutUtil.flip(cc.xyw(3, 23, 5), colSpec, orientation)); fc.setSelected(configuration.isMencoderFontConfig()); assdefaultstyle = new JCheckBox(Messages.getString("MEncoderVideo.36")); assdefaultstyle.setContentAreaFilled(false); assdefaultstyle.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMencoderAssDefaultStyle(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(assdefaultstyle, FormLayoutUtil.flip(cc.xyw(8, 23, 4), colSpec, orientation)); assdefaultstyle.setSelected(configuration.isMencoderAssDefaultStyle()); builder.addLabel(Messages.getString("MEncoderVideo.92"), FormLayoutUtil.flip(cc.xy(1, 29), colSpec, orientation)); subq = new JTextField(configuration.getMencoderVobsubSubtitleQuality()); subq.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setMencoderVobsubSubtitleQuality(subq.getText()); } }); builder.add(subq, FormLayoutUtil.flip(cc.xyw(3, 29, 1), colSpec, orientation)); configuration.addConfigurationListener(new ConfigurationListener() { @Override public void configurationChanged(ConfigurationEvent event) { if (event.getPropertyName() == null) { return; } if ((!event.isBeforeUpdate()) && event.getPropertyName().equals(PmsConfiguration.KEY_DISABLE_SUBTITLES)) { boolean enabled = !configuration.isDisableSubtitles(); ass.setEnabled(enabled); assdefaultstyle.setEnabled(enabled); fc.setEnabled(enabled); mencoder_noass_scale.setEnabled(enabled); mencoder_noass_outline.setEnabled(enabled); mencoder_noass_blur.setEnabled(enabled); mencoder_noass_subpos.setEnabled(enabled); ocw.setEnabled(enabled); och.setEnabled(enabled); subq.setEnabled(enabled); if (enabled) { ass.getItemListeners()[0].itemStateChanged(null); } } } }); JPanel panel = builder.getPanel(); // Apply the orientation to the panel and all components in it panel.applyComponentOrientation(orientation); return panel; }
From source file:org.kchine.rpf.PoolUtils.java
public static String cacheJar(URL url, String location, int logInfo, boolean forced) throws Exception { final String jarName = url.toString().substring(url.toString().lastIndexOf("/") + 1); if (!location.endsWith("/") && !location.endsWith("\\")) location += "/"; String fileName = location + jarName; new File(location).mkdirs(); final JTextArea area = ((logInfo & LOG_PRGRESS_TO_DIALOG) != 0) ? new JTextArea() : null; final JProgressBar jpb = ((logInfo & LOG_PRGRESS_TO_DIALOG) != 0) ? new JProgressBar(0, 100) : null; final JFrame f = ((logInfo & LOG_PRGRESS_TO_DIALOG) != 0) ? new JFrame("copying " + jarName + " ...") : null;//from ww w . j a va 2s . c om try { ResponseCache.setDefault(null); URLConnection urlC = null; Exception connectionException = null; for (int i = 0; i < RECONNECTION_RETRIAL_NBR; ++i) { try { urlC = url.openConnection(); connectionException = null; break; } catch (Exception e) { connectionException = e; } } if (connectionException != null) throw connectionException; InputStream is = url.openStream(); File file = new File(fileName); long urlLastModified = urlC.getLastModified(); if (!forced) { boolean somethingToDo = !file.exists() || file.lastModified() < urlLastModified || (file.length() != urlC.getContentLength() && !isValidJar(fileName)); if (!somethingToDo) return fileName; } if ((logInfo & LOG_PRGRESS_TO_DIALOG) != 0) { Runnable runnable = new Runnable() { public void run() { try { f.setUndecorated(true); f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); area.setEditable(false); area.setForeground(Color.white); area.setBackground(new Color(0x00, 0x80, 0x80)); jpb.setIndeterminate(true); jpb.setForeground(Color.white); jpb.setBackground(new Color(0x00, 0x80, 0x80)); JPanel p = new JPanel(new BorderLayout()); p.setBorder(BorderFactory.createLineBorder(Color.black, 3)); p.setBackground(new Color(0x00, 0x80, 0x80)); p.add(jpb, BorderLayout.SOUTH); p.add(area, BorderLayout.CENTER); f.add(p); f.pack(); f.setSize(300, 80); locateInScreenCenter(f); f.setVisible(true); System.out.println("here"); } catch (Exception e) { e.printStackTrace(); } } }; if (SwingUtilities.isEventDispatchThread()) runnable.run(); else { SwingUtilities.invokeLater(runnable); } } if ((logInfo & LOG_PRGRESS_TO_SYSTEM_OUT) != 0) { System.out.println("Downloading " + jarName + ":"); System.out.print("expected:==================================================\ndone :"); } if ((logInfo & LOG_PRGRESS_TO_LOGGER) != 0) { log.info("Downloading " + jarName + ":"); } int jarSize = urlC.getContentLength(); int currentPercentage = 0; FileOutputStream fos = null; fos = new FileOutputStream(fileName); int count = 0; int printcounter = 0; byte data[] = new byte[BUFFER_SIZE]; int co = 0; while ((co = is.read(data, 0, BUFFER_SIZE)) != -1) { fos.write(data, 0, co); count = count + co; int expected = (50 * count / jarSize); while (printcounter < expected) { if ((logInfo & LOG_PRGRESS_TO_SYSTEM_OUT) != 0) { System.out.print("="); } if ((logInfo & LOG_PRGRESS_TO_LOGGER) != 0) { log.info((int) (100 * count / jarSize) + "% done."); } ++printcounter; } if ((logInfo & LOG_PRGRESS_TO_DIALOG) != 0) { final int p = (int) (100 * count / jarSize); if (p > currentPercentage) { currentPercentage = p; final JTextArea fa = area; final JProgressBar fjpb = jpb; SwingUtilities.invokeLater(new Runnable() { public void run() { fjpb.setIndeterminate(false); fjpb.setValue(p); fa.setText("Copying " + jarName + " ..." + "\n" + p + "%" + " Done. "); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { fa.setCaretPosition(fa.getText().length()); fa.repaint(); fjpb.repaint(); } }); } } } /* * while ((oneChar = is.read()) != -1) { fos.write(oneChar); * count++; * * final int p = (int) (100 * count / jarSize); if (p > * currentPercentage) { System.out.print(p+" % "); currentPercentage = * p; if (showProgress) { final JTextArea fa = area; final * JProgressBar fjpb = jpb; SwingUtilities.invokeLater(new * Runnable() { public void run() { fjpb.setIndeterminate(false); * fjpb.setValue(p); fa.setText("\n" + p + "%" + " Done "); } }); * * SwingUtilities.invokeLater(new Runnable() { public void run() { * fa.setCaretPosition(fa.getText().length()); fa.repaint(); * fjpb.repaint(); } }); } else { if (p%2==0) System.out.print("="); } } * } * */ is.close(); fos.close(); } catch (MalformedURLException e) { System.err.println(e.toString()); throw e; } catch (IOException e) { System.err.println(e.toString()); } finally { if ((logInfo & LOG_PRGRESS_TO_DIALOG) != 0) { f.dispose(); } if ((logInfo & LOG_PRGRESS_TO_SYSTEM_OUT) != 0) { System.out.println("\n 100% of " + jarName + " has been downloaded \n"); } if ((logInfo & LOG_PRGRESS_TO_LOGGER) != 0) { log.info(" 100% of " + jarName + " has been downloaded"); } } return fileName; }
From source file:org.kepler.gui.ComponentLibraryPreferencesTab.java
/** * Initialize the top panel that contains controls for the table. *///from w w w. j a v a 2 s .c o m private void initDoc() { String header = StaticResources.getDisplayString("preferences.description1", "The Component Library is built using KAR files found" + " in the following local directories. Adding or removing local directories will rebuild" + " the component library.") + "\n\n" + StaticResources.getDisplayString("preferences.description2", "By selecting the search box next to remote" + " repositories, components from the remote repositories will be included" + " when searching components.") + "\n\n" + StaticResources.getDisplayString("preferences.description3", "By selecting the save box next to a local repository, KAR files will be saved" + " to that directory by default.") + "\n\n" + StaticResources.getDisplayString("preferences.description4", "By selecting the save box next to a remote repository, you will be asked " + " if you want to upload the KAR to that repository when it is saved."); JTextArea headerTextArea = new JTextArea(header); headerTextArea.setEditable(false); headerTextArea.setLineWrap(true); headerTextArea.setWrapStyleWord(true); headerTextArea.setPreferredSize(new Dimension(300, 400)); headerTextArea.setBackground(TabManager.BGCOLOR); JPanel headerPanel = new JPanel(new BorderLayout()); headerPanel.setBackground(TabManager.BGCOLOR); headerPanel.add(headerTextArea, BorderLayout.CENTER); JScrollPane headerPane = new JScrollPane(headerPanel); headerPane.setPreferredSize(new Dimension(300, 150)); add(headerPane); }
From source file:org.opencms.applet.upload.FileUploadApplet.java
/** * Displays the dialog that shows the list of files that will be overwritten on the server. * <p>/*from w ww . ja va2 s. c o m*/ * The user may uncheck the checkboxes in front of the relative paths to avoid overwriting. * <p> * * @param duplications * a list of Strings that are relative paths to the files that will be overwritten on the server * * @return one of */ private int showDuplicationsDialog(List duplications) { int rtv = ModalDialog.ERROR_OPTION; try { JTextArea dialogIntroPanel = new JTextArea(); dialogIntroPanel.setLineWrap(true); dialogIntroPanel.setWrapStyleWord(true); dialogIntroPanel.setText(m_overwriteDialogIntro); dialogIntroPanel.setEditable(false); dialogIntroPanel.setBackground(m_fileSelector.getBackground()); dialogIntroPanel.setFont(m_font); FileSelectionPanel selectionPanel = new FileSelectionPanel(duplications, m_fileSelector.getCurrentDirectory().getAbsolutePath()); JPanel stacker = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.gridheight = 1; gbc.gridwidth = 1; gbc.weightx = 1f; gbc.weighty = 0f; gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.BOTH; gbc.insets = new Insets(2, 2, 2, 2); stacker.add(dialogIntroPanel, gbc); gbc.weighty = 1f; gbc.gridy = 1; gbc.insets = new Insets(0, 2, 0, 2); stacker.add(selectionPanel, gbc); m_overwriteDialog = new ModalDialog(m_fileSelector, m_overwriteDialogTitle, m_overwriteDialogOk, m_overwriteDialogCancel, stacker); m_overwriteDialog.setSize(new Dimension(560, 280)); //dialog.setResizable(false); m_overwriteDialog.showDialog(); rtv = m_overwriteDialog.getReturnValue(); } catch (Throwable f) { f.printStackTrace(System.err); } return rtv; }
From source file:org.openmicroscopy.shoola.agents.fsimporter.view.ImporterUIElement.java
/** * Builds and lays out the header./*from ww w .j a v a 2 s .c o m*/ * * @return See above. */ private JPanel buildHeader() { sizeLabel = UIUtilities.createComponent(null); sizeLabel.setText(FileUtils.byteCountToDisplaySize(sizeImport)); reportLabel = UIUtilities.setTextFont("Report:", Font.BOLD); importSizeLabel = UIUtilities.setTextFont("Import Size:", Font.BOLD); double[][] design = new double[][] { { TableLayout.PREFERRED }, { TableLayout.PREFERRED, TableLayout.PREFERRED } }; TableLayout layout = new TableLayout(design); JPanel detailsPanel = new JPanel(layout); detailsPanel.setBackground(UIUtilities.BACKGROUND_COLOR); JPanel p = createRow(); p.add(reportLabel); p.add(numberOfImportLabel); detailsPanel.add(p, "0, 0"); p = createRow(); p.add(importSizeLabel); p.add(sizeLabel); detailsPanel.add(p, "0, 1"); JPanel middlePanel = new JPanel(); middlePanel.setBackground(UIUtilities.BACKGROUND_COLOR); middlePanel.add(filterButton); JTextArea description = new JTextArea(MESSAGE); makeLabelStyle(description); description.setBackground(UIUtilities.BACKGROUND_COLOR); JPanel descriptionPanel = new JPanel(); descriptionPanel.setBackground(UIUtilities.BACKGROUND_COLOR); descriptionPanel.add(description); JPanel header = new JPanel(); header.setBackground(UIUtilities.BACKGROUND_COLOR); header.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); header.setLayout(new BorderLayout()); header.add(Box.createVerticalStrut(10), BorderLayout.NORTH); header.add(detailsPanel, BorderLayout.WEST); header.add(middlePanel, BorderLayout.CENTER); header.add(descriptionPanel, BorderLayout.EAST); header.add(Box.createVerticalStrut(10), BorderLayout.SOUTH); return header; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java
/** * Initializes a <code>TextPane</code>. * /*from www. j a v a 2 s .c om*/ * @return See above. */ private JTextArea createTextPane() { JTextArea pane = new JTextArea(); pane.setWrapStyleWord(true); pane.setOpaque(false); pane.setBackground(UIUtilities.BACKGROUND_COLOR); return pane; }
From source file:org.revager.tools.GUITools.java
/** * Creates a new title text area for popup windows. * /* ww w . j av a2s .c o m*/ * @param titleText * the title text * * @return the newly created text area */ public static JTextArea newPopupTitleArea(String titleText) { JTextArea textTitle = new JTextArea(); textTitle.setEditable(false); textTitle.setText(titleText); textTitle.setBackground(UI.POPUP_BACKGROUND); textTitle.setFont(UI.STANDARD_FONT.deriveFont(Font.BOLD)); textTitle.setLineWrap(true); textTitle.setWrapStyleWord(true); textTitle.setFocusable(false); textTitle.setBorder(new EmptyBorder(5, 5, 5, 5)); return textTitle; }
From source file:semgen.extraction.RadialGraph.Clusterer.java
public String clusterAndRecolor(AggregateLayout<String, Number> layout, int numEdgesToRemove, Color[] colors, boolean groupClusters) { setCursor(new Cursor(Cursor.WAIT_CURSOR)); String moduletable = ""; Graph<String, Number> g = layout.getGraph(); layout.removeAll();//from w w w .j a v a2 s. com EdgeBetweennessClusterer<String, Number> clusterer = new EdgeBetweennessClusterer<String, Number>( numEdgesToRemove); Set<Set<String>> clusterSet = clusterer.transform(g); List<Number> edges = clusterer.getEdgesRemoved(); sempanel.removeAll(); int i = 0; // Set the colors of each node so that each cluster's vertices have the same color extractor.clusterpanel.checkboxpanel.removeAll(); for (Iterator<Set<String>> cIt = clusterSet.iterator(); cIt.hasNext();) { moduletable = moduletable + "\nCLUSTER " + (i + 1); Set<String> vertices = cIt.next(); Color c = colors[i % colors.length]; Set<DataStructure> datastrs = new HashSet<DataStructure>(); for (String vertex : vertices) { datastrs.add(extractor.semsimmodel.getDataStructure(vertex)); } JLabel modulelabel = new JLabel("Cluster " + (i + 1)); modulelabel.setOpaque(true); modulelabel.setFont(SemGenFont.defaultBold()); modulelabel.setBackground(c); modulelabel.setAlignmentX(LEFT_ALIGNMENT); sempanel.add(modulelabel); // Update the semantics panel Set<String> addedterms = new HashSet<String>(); for (String ver : vertices) { if (extractor.semsimmodel.getDataStructure(ver).hasPhysicalProperty()) { if (extractor.semsimmodel.getDataStructure(ver).getPhysicalProperty() .getPhysicalPropertyOf() != null) { PhysicalModelComponent pmc = extractor.semsimmodel.getDataStructure(ver) .getPhysicalProperty().getPhysicalPropertyOf(); String name = null; if (pmc.hasRefersToAnnotation()) { name = pmc.getFirstRefersToReferenceOntologyAnnotation().getValueDescription(); } else { name = pmc.getName(); } if (!addedterms.contains(name)) { addedterms.add(name); JTextArea enttext = new JTextArea(name); enttext.setOpaque(true); enttext.setBackground(c); enttext.setFont(SemGenFont.defaultPlain(-2)); if (pmc instanceof PhysicalProcess) { enttext.setFont(SemGenFont.defaultItalic(-2)); name = "Process: " + name; } else name = "Entity: " + name; enttext.setWrapStyleWord(true); enttext.setLineWrap(true); enttext.setBorder(BorderFactory.createEmptyBorder(7, 7, 0, 0)); enttext.setAlignmentX(LEFT_ALIGNMENT); sempanel.add(enttext); moduletable = moduletable + "\n " + name; } } } } sempanel.validate(); sempanel.repaint(); semscroller.repaint(); semscroller.validate(); this.repaint(); this.validate(); colorCluster(vertices, c); ExtractorJCheckBox box = new ExtractorJCheckBox("Cluster " + (i + 1), datastrs); box.setBackground(c); box.setOpaque(true); box.addItemListener(extractor); extractor.clusterpanel.checkboxpanel.add(box); if (groupClusters == true) groupCluster(layout, vertices); i++; } refreshModulePanel(); for (Number e : g.getEdges()) { if (edges.contains(e)) edgePaints.put(e, Color.lightGray); else edgePaints.put(e, Color.black); } nummodules = i; setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return moduletable; }
From source file:util.ui.UiUtilities.java
/** * Creates a text area that holds a help text. * * @param msg//w ww . jav a2 s . c o m * The help text. * @return A text area containing the help text. */ public static JTextArea createHelpTextArea(String msg) { JTextArea descTA = new JTextArea(msg); descTA.setBorder(BorderFactory.createEmptyBorder()); descTA.setFont(new JLabel().getFont()); descTA.setEditable(false); descTA.setOpaque(false); descTA.setWrapStyleWord(true); descTA.setLineWrap(true); descTA.setFocusable(false); Color bg = new JPanel().getBackground(); descTA.setBackground(new Color(bg.getRed(), bg.getGreen(), bg.getBlue())); return descTA; }