List of usage examples for javax.swing JTextArea setVisible
@BeanProperty(hidden = true, visualUpdate = true) public void setVisible(boolean aFlag)
From source file:JTextAreaI18N.java
public JTextAreaI18N() { GraphicsEnvironment.getLocalGraphicsEnvironment(); JTextArea textArea = new JTextArea(davidMessage); textArea.setFont(new Font("LucidaSans", Font.PLAIN, 40)); this.getContentPane().add(textArea); textArea.setVisible(true); }
From source file:agentlogfileanalyzer.histogram.AbstractHistogram.java
/** * Creates a panel for error messages. The error message is given as * parameter./* www . ja v a 2 s. c o m*/ * * @param _text * the error message * @return a panel for error messages */ private JPanel createErrorPanel(String _text) { JPanel jPanelChart = new JPanel(); // ...display error notice instead of chart. JTextArea jTextAreaAnzeige = new JTextArea(_text); jTextAreaAnzeige.setVisible(true); jTextAreaAnzeige.setBackground(new Color(238, 238, 238)); jPanelChart.add(jTextAreaAnzeige); jPanelChart.setVisible(true); return jPanelChart; }
From source file:com.loy.MainFrame.java
@SuppressWarnings("rawtypes") public void init() { String src = "ee.png"; try {//from w w w . j a v a 2s. co m ClassPathResource classPathResource = new ClassPathResource(src); image = ImageIO.read(classPathResource.getURL()); this.setIconImage(image); } catch (IOException e) { } menu = new JMenu("LOG CONSOLE"); this.jmenuBar = new JMenuBar(); this.jmenuBar.add(menu); panel = new JPanel(new BorderLayout()); this.add(panel); ClassPathResource classPathResource = new ClassPathResource("application.yml"); Yaml yaml = new Yaml(); Map result = null; try { result = (Map) yaml.load(classPathResource.getInputStream()); } catch (IOException e1) { e1.printStackTrace(); } String platformStr = result.get("platform").toString(); String version = result.get("version").toString(); String jvmOption = result.get("jvmOption").toString(); @SuppressWarnings("unchecked") List<String> projects = (List<String>) result.get("projects"); platform = Platform.valueOf(platformStr); final Runtime runtime = Runtime.getRuntime(); File pidsForder = new File("./pids"); if (!pidsForder.exists()) { pidsForder.mkdir(); } else { File[] files = pidsForder.listFiles(); if (files != null) { for (File f : files) { f.deleteOnExit(); String pidStr = f.getName(); try { Long pid = new Long(pidStr); if (Processes.isProcessRunning(platform, pid)) { if (Platform.Windows == platform) { Processes.tryKillProcess(null, platform, new NullProcessor(), pid); } else { Processes.killProcess(null, platform, new NullProcessor(), pid); } } } catch (Exception ex) { } } } } File currentForder = new File(""); String rootPath = currentForder.getAbsolutePath(); rootPath = rootPath.replace(File.separator + "build" + File.separator + "libs", ""); rootPath = rootPath.replace(File.separator + "e-example-ms-start-w", ""); for (String value : projects) { String path = value; String[] values = value.split("/"); value = values[values.length - 1]; String appName = value; value = rootPath + "/" + path + "/build/libs/" + value + "-" + version + ".jar"; JMenuItem menuItem = new JMenuItem(appName); JTextArea textArea = new JTextArea(); textArea.setVisible(true); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setAutoscrolls(true); JScrollPane scorll = new JScrollPane(textArea); this.textSreaMap.put(appName, scorll); EComposite ecomposite = new EComposite(); ecomposite.setCommand(value); ecomposite.setTextArea(textArea); composites.put(appName, ecomposite); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Collection<JScrollPane> values = textSreaMap.values(); for (JScrollPane t : values) { t.setVisible(false); } String actions = e.getActionCommand(); JScrollPane textArea = textSreaMap.get(actions); if (textArea != null) { textArea.setVisible(true); panel.removeAll(); panel.add(textArea); panel.repaint(); panel.validate(); self.repaint(); self.validate(); } } }); menu.add(menuItem); } new Thread(new Runnable() { @Override public void run() { int size = composites.keySet().size(); int index = 1; for (String appName : composites.keySet()) { EComposite composite = composites.get(appName); try { Process process = runtime.exec( "java " + jvmOption + " -Dfile.encoding=UTF-8 -jar " + composite.getCommand()); Long pid = Processes.processId(process); pids.add(pid); File pidsFile = new File("./pids", pid.toString()); pidsFile.createNewFile(); new WriteLogThread(process.getInputStream(), composite.getTextArea()).start(); } catch (IOException e) { e.printStackTrace(); } synchronized (lock) { try { if (index < size) { lock.wait(); } else { index++; } } catch (InterruptedException e) { e.printStackTrace(); } } } } }).start(); }
From source file:org.ecoinformatics.seek.datasource.eml.eml2.Eml200DataSource.java
public void preview() { String displayText = "PREVIEW NOT IMPLEMENTED FOR THIS ACTOR"; JFrame frame = new JFrame(this.getName() + " Preview"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel panel = new JPanel(new BorderLayout()); JScrollPane scrollPane = null; JTable jtable = null;/*w w w. java2 s . co m*/ try { // set everything up (datawise) this.initialize(); // check the entity - different displays for different formats // Compressed file if (this._selectedTableEntity.getHasGZipDataFile() || this._selectedTableEntity.getHasTarDataFile() || this._selectedTableEntity.getHasZipDataFile()) { displayText = "Selected entity is a compressed file. \n" + "Preview not implemented for output format: " + this.dataOutputFormat.getExpression(); if (this._dataOutputFormat instanceof Eml200DataOutputFormatUnzippedFileName) { Eml200DataOutputFormatUnzippedFileName temp = (Eml200DataOutputFormatUnzippedFileName) this._dataOutputFormat; displayText = "Files: \n"; for (int i = 0; i < temp.getTargetFilePathInZip().length; i++) { displayText += temp.getTargetFilePathInZip()[i] + "\n"; } } } // SPATIALRASTERENTITY or SPATIALVECTORENTITY are "image entities" // as far as the parser is concerned else if (this._selectedTableEntity.getIsImageEntity()) { // use the content of the cache file displayText = new String(this.getSelectedCachedDataItem().getData()); } // TABLEENTITY else { // holds the rows for the table on disk with some in memory String vectorTempDir = DotKeplerManager.getInstance().getCacheDirString(); // + "vector" // + File.separator; PersistentVector rowData = new PersistentVector(vectorTempDir); // go through the rows and add them to the persistent vector // model Vector row = this.gotRowVectorFromSource(); while (!row.isEmpty()) { rowData.addElement(row); row = this.gotRowVectorFromSource(); } // the column headers for the table Vector columns = this.getColumns(); /* * with java 6, there is a more built-in sorting mechanism that * does not require the custom table sorter class */ TableModel tableModel = new PersistentTableModel(rowData, columns); TableSorter tableSorter = new TableSorter(tableModel); jtable = new JTable(tableSorter) { // make this table read-only by overriding the default // implementation public boolean isCellEditable(int row, int col) { return false; } }; // sets up the listeners for sorting and such tableSorter.setTableHeader(jtable.getTableHeader()); // set up the listener to trash persisted data when done frame.addWindowListener(new PersistentTableModelWindowListener((PersistentTableModel) tableModel)); } } catch (Exception e) { displayText = "Problem encountered while generating preview: \n" + e.getMessage(); log.error(displayText); e.printStackTrace(); } // make sure there is a jtable, otherwise show just a text version of // the data if (jtable != null) { jtable.setVisible(true); // jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); scrollPane = new JScrollPane(jtable); } else { JTextArea textArea = new JTextArea(); textArea.setColumns(80); textArea.setText(displayText); textArea.setVisible(true); scrollPane = new JScrollPane(textArea); } scrollPane.setVisible(true); panel.setOpaque(true); panel.add(scrollPane, BorderLayout.CENTER); frame.setContentPane(panel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }