List of usage examples for javax.swing JTextArea setEditable
@BeanProperty(description = "specifies if the text can be edited") public void setEditable(boolean b)
TextComponent
should be editable. From source file:org.gtdfree.GTDFree.java
/** * This method initializes aboutDialog * //from w w w . jav a 2 s .com * @return javax.swing.JDialog */ private JDialog getAboutDialog() { if (aboutDialog == null) { aboutDialog = new JDialog(getJFrame(), true); aboutDialog.setTitle(Messages.getString("GTDFree.About.Free")); //$NON-NLS-1$ Image i = ApplicationHelper.loadImage(ApplicationHelper.icon_name_large_logo); //$NON-NLS-1$ ImageIcon ii = new ImageIcon(i); JTabbedPane jtp = new JTabbedPane(); JPanel jp = new JPanel(); jp.setLayout(new GridBagLayout()); JLabel jl = new JLabel("GTD-Free", ii, SwingConstants.CENTER); //$NON-NLS-1$ jl.setIconTextGap(22); jl.setFont(jl.getFont().deriveFont((float) 24)); jp.add(jl, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 11, 11), 0, 0)); String s = "Version " + ApplicationHelper.getVersion(); //$NON-NLS-1$ jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 11, 4, 11), 0, 0)); s = Messages.getString("GTDFree.About.DBType") //$NON-NLS-1$ + getEngine().getGTDModel().getDataRepository().getDatabaseType(); jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 2, 11), 0, 0)); s = Messages.getString("GTDFree.About.DBloc") + getEngine().getDataFolder(); //$NON-NLS-1$ jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 3, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 11, 4, 11), 0, 0)); jp.add(new JLabel("Copyright 2008,2009 ikesan@users.sourceforge.net", SwingConstants.CENTER), //$NON-NLS-1$ new GridBagConstraints(0, 4, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab("About", jp); //$NON-NLS-1$ jp = new JPanel(); jp.setLayout(new GridBagLayout()); TableModel tm = new AbstractTableModel() { private static final long serialVersionUID = -8449423008172417278L; private String[] props; private String[] getProperties() { if (props == null) { props = System.getProperties().keySet().toArray(new String[System.getProperties().size()]); Arrays.sort(props); } return props; } @Override public String getColumnName(int column) { switch (column) { case 0: return Messages.getString("GTDFree.About.Prop"); //$NON-NLS-1$ case 1: return Messages.getString("GTDFree.About.Val"); //$NON-NLS-1$ default: return null; } } public int getColumnCount() { return 2; } public int getRowCount() { return getProperties().length; } public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return getProperties()[rowIndex]; case 1: return System.getProperty(getProperties()[rowIndex]); default: return null; } } }; JTable jt = new JTable(tm); jp.add(new JScrollPane(jt), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab(Messages.getString("GTDFree.About.SysP"), jp); //$NON-NLS-1$ jp = new JPanel(); jp.setLayout(new GridBagLayout()); JTextArea ta = new JTextArea(); ta.setEditable(false); ta.setText(ApplicationHelper.loadLicense()); ta.setCaretPosition(0); jp.add(new JScrollPane(ta), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab("License", jp); //$NON-NLS-1$ aboutDialog.setContentPane(jtp); aboutDialog.setSize(550, 300); //aboutDialog.pack(); aboutDialog.setLocationRelativeTo(getJFrame()); } return aboutDialog; }
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 .jav a2 s . 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 ww .ja v a 2s . 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.nuclos.client.dbtransfer.DBTransferImport.java
private boolean setupPreviewPanel(List<PreviewPart> previewParts) { boolean blnTransferWithWarnings = false; jpnPreviewHeader.removeAll();// w ww. jav a 2 s . c o m jpnPreviewFooter.removeAll(); // setup parameter scroll pane jpnPreviewContent.removeAll(); double[] rowContraints = new double[previewParts.size()]; for (int i = 0; i < previewParts.size(); i++) rowContraints[i] = TableLayout.PREFERRED; final int iWidthBeginnigSpace = 3; final int iWidthSeparator = 6; final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); JLabel lbPreviewHeaderEntity = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.11", "Entit\u00e4t")); JLabel lbPreviewHeaderTable = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.12", "Tabellenname")); JLabel lbPreviewHeaderRecords = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.4", "Datens\u00e4tze")); lbPreviewHeaderRecords.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.5", "Anzahl der betroffenen Datens\u00e4tze")); utils.initJPanel(jpnPreviewContent, new double[] { iWidthBeginnigSpace, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED }, rowContraints); int iWidthEntityLabelSize = 0; int iWidthTableLabelSize = 0; int iWidthRecordsLabelSize = 0; int iCountNew = 0; int iCountDeleted = 0; int iCountChanged = 0; int iRow = 0; for (final PreviewPart pp : previewParts) { String tooltip = ""; JLabel lbEntity = new JLabel(pp.getEntity()); JLabel lbTable = new JLabel(pp.getTable()); JLabel lbRecords = new JLabel(String.valueOf(pp.getDataRecords())); lbRecords.setHorizontalAlignment(SwingConstants.RIGHT); if (lbEntity.getPreferredSize().width < lbPreviewHeaderEntity.getPreferredSize().width) lbEntity.setPreferredSize(lbPreviewHeaderEntity.getPreferredSize()); if (lbTable.getPreferredSize().width < lbPreviewHeaderTable.getPreferredSize().width) lbTable.setPreferredSize(lbPreviewHeaderTable.getPreferredSize()); if (lbRecords.getPreferredSize().width < lbPreviewHeaderRecords.getPreferredSize().width) lbRecords.setPreferredSize(lbPreviewHeaderRecords.getPreferredSize()); iWidthEntityLabelSize = iWidthEntityLabelSize < lbEntity.getPreferredSize().width ? lbEntity.getPreferredSize().width : iWidthEntityLabelSize; iWidthTableLabelSize = iWidthTableLabelSize < lbTable.getPreferredSize().width ? lbTable.getPreferredSize().width : iWidthTableLabelSize; iWidthRecordsLabelSize = iWidthRecordsLabelSize < lbRecords.getPreferredSize().width ? lbRecords.getPreferredSize().width : iWidthRecordsLabelSize; Icon icoStatement = null; switch (pp.getType()) { case PreviewPart.NEW: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.6", "Entit\u00e4t wird hinzugef\u00fcgt"); icoStatement = ParameterEditor.COMPARE_ICON_NEW; iCountNew++; break; case PreviewPart.CHANGE: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.7", "Entit\u00e4t wird ge\u00e4ndert"); icoStatement = ParameterEditor.COMPARE_ICON_VALUE_CHANGED; iCountChanged++; break; case PreviewPart.DELETE: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.8", "Entit\u00e4t wird gel\u00f6scht"); icoStatement = ParameterEditor.COMPARE_ICON_DELETED; iCountDeleted++; break; } JLabel lbIcon = new JLabel(icoStatement); JLabel lbStatemnts = new JLabel("<html><u>" + localeDelegate.getMessage("dbtransfer.import.step1.9", "Script anzeigen") + "...</u></html>"); lbStatemnts.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); lbStatemnts.addMouseListener(new MouseListener() { @Override public void mouseReleased(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseClicked(MouseEvent e) { String statements = ""; for (String statement : pp.getStatements()) { statements = statements + statement + ";\n\n"; } JTextArea txtArea = new JTextArea(statements); txtArea.setEditable(false); txtArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JScrollPane scroll = new JScrollPane(txtArea); scroll.getVerticalScrollBar().setUnitIncrement(20); scroll.setPreferredSize(new Dimension(600, 300)); scroll.setBorder(BorderFactory.createEmptyBorder()); MainFrameTab overlayFrame = new MainFrameTab( localeDelegate.getMessage("dbtransfer.import.step1.10", "Script f\u00fcr") + " " + pp.getEntity() + " (" + pp.getTable() + ")"); overlayFrame.setLayeredComponent(scroll); ifrm.add(overlayFrame); } }); lbIcon.setToolTipText(tooltip); lbStatemnts.setToolTipText(tooltip); lbEntity.setToolTipText(tooltip); lbTable.setToolTipText(tooltip); jpnPreviewContent.add(lbEntity, "1," + iRow + ",l,c"); jpnPreviewContent.add(lbTable, "3," + iRow + ",l,c"); jpnPreviewContent.add(lbRecords, "5," + iRow + ",r,c"); jpnPreviewContent.add(lbIcon, "7," + iRow + ",l,c"); jpnPreviewContent.add(lbStatemnts, "8," + iRow + ",l,c"); if (pp.getWarning() > 0) { lbIcon.setIcon(Icons.getInstance().getIconPriorityCancel16()); blnTransferWithWarnings = true; } iRow++; } jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "2,0,2," + (iRow - 1)); jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "4,0,4," + (iRow - 1)); jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "6,0,6," + (iRow - 1)); // setup preview header utils.initJPanel(jpnPreviewHeader, new double[] { iWidthBeginnigSpace, iWidthEntityLabelSize, iWidthSeparator, iWidthTableLabelSize, iWidthSeparator, iWidthRecordsLabelSize, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, TableLayout.PREFERRED }, new double[] { TableLayout.PREFERRED }); if (previewParts.isEmpty()) { jpnPreviewHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.18", "Keine Struktur\u00e4nderungen am Datenbankschema.")), "0,0,8,0"); return blnTransferWithWarnings; } jpnPreviewHeader.add(lbPreviewHeaderEntity, "1,0"); jpnPreviewHeader.add(lbPreviewHeaderTable, "3,0"); jpnPreviewHeader.add(lbPreviewHeaderRecords, "5,0"); jpnPreviewHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.13", "\u00c4nderung")), "7,0"); // setup preview footer utils.initJPanel(jpnPreviewFooter, new double[] { TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED }, new double[] { TableLayout.PREFERRED }); final JLabel lbCompare = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.14", "\u00c4nderungen") + ":"); final JLabel lbCompareNew = new JLabel(iCountNew + ""); final JLabel lbCompareDeleted = new JLabel(iCountDeleted + ""); final JLabel lbCompareValueChanged = new JLabel(iCountChanged + ""); lbCompareNew.setIcon(ParameterEditor.COMPARE_ICON_NEW); lbCompareDeleted.setIcon(ParameterEditor.COMPARE_ICON_DELETED); lbCompareValueChanged.setIcon(ParameterEditor.COMPARE_ICON_VALUE_CHANGED); lbCompareNew.setToolTipText(localeDelegate.getMessage("dbtransfer.import.step1.15", "Neue Entit\u00e4ten")); lbCompareDeleted.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.17", "Gel\u00f6schte Entit\u00e4ten")); lbCompareValueChanged.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.16", "Ge\u00e4nderte Entit\u00e4ten")); jpnPreviewFooter.add(lbCompare, "1,0,r,c"); jpnPreviewFooter.add(lbCompareNew, "2,0,r,c"); jpnPreviewFooter.add(lbCompareValueChanged, "3,0,r,c"); jpnPreviewFooter.add(lbCompareDeleted, "4,0,r,c"); return blnTransferWithWarnings; }
From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java
private JComponent createConsolePanel() { JTextArea consoleArea = new JTextArea(); consoleArea.setToolTipText("General progress information"); consoleArea.setEditable(false); Console console = new Console(); console.setTextArea(consoleArea);/*from w w w. j a v a2s. c om*/ System.setOut(new PrintStream(console)); System.setErr(new PrintStream(console)); JScrollPane consoleScrollPane = new JScrollPane(consoleArea); consoleScrollPane.setBorder(BorderFactory.createTitledBorder("Console")); consoleScrollPane.setPreferredSize(new Dimension(800, 200)); consoleScrollPane.setAutoscrolls(true); ObjectExchange.console = console; return consoleScrollPane; }
From source file:org.onebusaway.phone.client.SimplePhoneClient.java
private static void setupGui(AgiClientScriptImpl script) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); KeyPressHandler handler = new KeyPressHandler(script); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.addKeyListener(handler);/*from w w w.ja va2 s. c o m*/ JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(4, 3)); panel.add(buttonPanel, BorderLayout.CENTER); String buttons = "123456789*0#"; for (int i = 0; i < buttons.length(); i++) addButton(buttonPanel, script, handler, buttons.charAt(i)); Document document = script.getDocument(); final JTextArea textArea = new JTextArea(document); textArea.setEditable(false); textArea.addKeyListener(handler); document.addDocumentListener(new ScrollDocumentToEnd(textArea)); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setPreferredSize(new Dimension(300, 100)); scrollPane.addKeyListener(handler); panel.add(scrollPane, BorderLayout.SOUTH); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true); }
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>/*w w w.j a v a 2s .co 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
/** * Make the JTextArea represent a multiline label. * /*ww w . ja v a 2 s .c o m*/ * @param textArea The component to handle. */ private void makeLabelStyle(JTextArea textArea) { if (textArea == null) return; textArea.setEditable(false); textArea.setCursor(null); textArea.setOpaque(false); textArea.setFocusable(false); }
From source file:org.optaconf.benchmark.examples.common.swingui.SolverAndPersistenceFrame.java
private JPanel createMiddlePanel() { middlePanel = new JPanel(new CardLayout()); JPanel usageExplanationPanel = new JPanel(new BorderLayout(5, 5)); ImageIcon usageExplanationIcon = new ImageIcon( getClass().getResource(solutionPanel.getUsageExplanationPath())); JLabel usageExplanationLabel = new JLabel(usageExplanationIcon); // Allow splitPane divider to be moved to the right usageExplanationLabel.setMinimumSize(new Dimension(100, 100)); usageExplanationPanel.add(usageExplanationLabel, BorderLayout.CENTER); JPanel descriptionPanel = new JPanel(new BorderLayout(2, 2)); descriptionPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); descriptionPanel.add(new JLabel("Example description"), BorderLayout.NORTH); JTextArea descriptionTextArea = new JTextArea(8, 70); descriptionTextArea.setEditable(false); descriptionTextArea.setText(solutionBusiness.getAppDescription()); descriptionPanel.add(new JScrollPane(descriptionTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); usageExplanationPanel.add(descriptionPanel, BorderLayout.SOUTH); middlePanel.add(usageExplanationPanel, "usageExplanationPanel"); JComponent wrappedSolutionPanel; if (solutionPanel.isWrapInScrollPane()) { wrappedSolutionPanel = new JScrollPane(solutionPanel); } else {/*from ww w . j a va2 s.com*/ wrappedSolutionPanel = solutionPanel; } middlePanel.add(wrappedSolutionPanel, "solutionPanel"); return middlePanel; }
From source file:org.pgptool.gui.ui.tools.UiUtils.java
private static JScrollPane getScrollableMessage(String msg) { JTextArea textArea = new JTextArea(msg); textArea.setLineWrap(true);/*from w ww . j av a2 s. c o m*/ textArea.setWrapStyleWord(true); textArea.setEditable(false); textArea.setMargin(new Insets(5, 5, 5, 5)); textArea.setFont(new JTextField().getFont()); // dirty fix to use better font JScrollPane scrollPane = new JScrollPane(); scrollPane.setPreferredSize(new Dimension(700, 150)); scrollPane.getViewport().setView(textArea); return scrollPane; }