private void updateTemplateFromEditor(PrintfTemplate template) { ArrayList params = new ArrayList(); String format = null; int text_length = editorPane.getDocument().getLength(); try { format = editorPane.getDocument().getText(0, text_length); } catch (BadLocationException ex1) { } Element section_el = editorPane.getDocument().getDefaultRootElement(); // Get number of paragraphs. int num_para = section_el.getElementCount(); for (int p_count = 0; p_count < num_para; p_count++) { Element para_el = section_el.getElement(p_count); // Enumerate the content elements int num_cont = para_el.getElementCount(); for (int c_count = 0; c_count < num_cont; c_count++) { Element content_el = para_el.getElement(c_count); AttributeSet attr = content_el.getAttributes(); // Get the name of the style applied to this content element; may be null String sn = (String) attr.getAttribute(StyleConstants.NameAttribute); // Check if style name match if (sn != null && sn.startsWith("Parameter")) { // we extract the label. JLabel l = (JLabel) StyleConstants.getComponent(attr); if (l != null) { params.add(l.getName()); } } } } template.setFormat(format); template.setTokens(params); }
private void updateDisplay() { // first, set block colours textView.setBackground(getColour(backgroundColour("text-background-colour"))); textView.setForeground(getColour(foregroundColour("text-foreground-colour"))); textView.setCaretColor(getColour(foregroundColour("text-caret-colour"))); problemsView.setBackground(getColour(backgroundColour("problems-background-colour"))); problemsView.setForeground(getColour(foregroundColour("problems-foreground-colour"))); consoleView.setBackground(getColour(backgroundColour("console-background-colour"))); consoleView.setForeground(getColour(foregroundColour("console-foreground-colour"))); // second, set colours on the code! java.util.List<Lexer.Token> tokens = Lexer.tokenise(textView.getText(), true); int pos = 0; for (Lexer.Token t : tokens) { int len = t.toString().length(); if (t instanceof Lexer.RightBrace || t instanceof Lexer.LeftBrace) { highlightArea(pos, len, foregroundColour("text-brace-colour")); } else if (t instanceof Lexer.Strung) { highlightArea(pos, len, foregroundColour("text-string-colour")); } else if (t instanceof Lexer.Comment) { highlightArea(pos, len, foregroundColour("text-comment-colour")); } else if (t instanceof Lexer.Quote) { highlightArea(pos, len, foregroundColour("text-quote-colour")); } else if (t instanceof Lexer.Comma) { highlightArea(pos, len, foregroundColour("text-comma-colour")); } else if (t instanceof Lexer.Identifier) { highlightArea(pos, len, foregroundColour("text-identifier-colour")); } else if (t instanceof Lexer.Integer) { highlightArea(pos, len, foregroundColour("text-integer-colour")); } pos += len; } }
private void updateEditorView() { editorPane.setText(""); numParameters = 0; try { java.util.List elements = editableTemplate.getPrintfElements(); for (Iterator it = elements.iterator(); it.hasNext(); ) { PrintfUtil.PrintfElement el = (PrintfUtil.PrintfElement) it.next(); if (el.getFormat().equals(PrintfUtil.PrintfElement.FORMAT_NONE)) { appendText(el.getElement(), PLAIN_ATTR); } else { insertParameter( (ConfigParamDescr) paramKeys.get(el.getElement()), el.getFormat(), editorPane.getDocument().getLength()); } } } catch (Exception ex) { JOptionPane.showMessageDialog( this, "Invalid Format: " + ex.getMessage(), "Invalid Printf Format", JOptionPane.ERROR_MESSAGE); selectedPane = 1; printfTabPane.setSelectedIndex(selectedPane); updatePane(selectedPane); } }
// For compatibility with writers when talking to the JVM. public void write(char[] buffer, int offset, int length) { String text = new String(buffer, offset, length); SwingUtilities.invokeLater( () -> { try { pane.getDocument().insertString(pane.getDocument().getLength(), text, properties); } catch (Exception e) { } }); }
public Container CreateContentPane() { // Create the content-pane-to-be. JPanel contentPane = new JPanel(new BorderLayout()); contentPane.setOpaque(true); // the log panel log = new JTextPane(); log.setEditable(false); log.setBackground(Color.BLACK); logPane = new JScrollPane(log); kit = new HTMLEditorKit(); doc = new HTMLDocument(); log.setEditorKit(kit); log.setDocument(doc); DefaultCaret c = (DefaultCaret) log.getCaret(); c.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); ClearLog(); // the preview panel previewPane = new DrawPanel(); previewPane.setPaperSize(paper_top, paper_bottom, paper_left, paper_right); // status bar statusBar = new StatusBar(); Font f = statusBar.getFont(); statusBar.setFont(f.deriveFont(Font.BOLD, 15)); Dimension d = statusBar.getMinimumSize(); d.setSize(d.getWidth(), d.getHeight() + 30); statusBar.setMinimumSize(d); // layout Splitter split = new Splitter(JSplitPane.VERTICAL_SPLIT); split.add(previewPane); split.add(logPane); split.setDividerSize(8); contentPane.add(statusBar, BorderLayout.SOUTH); contentPane.add(split, BorderLayout.CENTER); // open the file if (recentFiles[0].length() > 0) { OpenFileOnDemand(recentFiles[0]); } // connect to the last port ListSerialPorts(); if (Arrays.asList(portsDetected).contains(recentPort)) { OpenPort(recentPort); } return contentPane; }
private void _applyFontStyleForSelection(Font font) { StyledDocument doc = mTextEditor.getStyledDocument(); MutableAttributeSet attrs = mTextEditor.getInputAttributes(); StyleConstants.setFontFamily(attrs, font.getFamily()); StyleConstants.setFontSize(attrs, font.getSize()); StyleConstants.setBold(attrs, ((font.getStyle() & Font.BOLD) != 0)); StyleConstants.setItalic(attrs, ((font.getStyle() & Font.ITALIC) != 0)); StyleConstants.setUnderline(attrs, ((font.getStyle() & Font.CENTER_BASELINE) != 0)); int start = mTextEditor.getSelectionStart(); int end = mTextEditor.getSelectionEnd(); doc.setCharacterAttributes(start, (end - start), attrs, false); }
public void prettyPrint() { try { // clear old problem messages problemsView.setText(""); // update status view statusView.setText(" Parsing ..."); LispExpr root = Parser.parse(textView.getText()); statusView.setText(" Pretty Printing ..."); String newText = PrettyPrinter.prettyPrint(root); textView.setText(newText); statusView.setText(" Done."); } catch (Error e) { System.err.println(e.getMessage()); statusView.setText(" Errors."); } }
/** * Gets the displayed value, and uses the converter to convert the shared value to units this * instance is supposed to represent. If the displayed value and shared value are different, * then we turn off our document filter and update our value to match the shared value. We * re-enable the document filter afterwards. */ @Override protected void paintComponent(Graphics g) { super.paintComponent(g); try { StyledDocument doc = getStyledDocument(); double actualValue = (multiplier.getDisplayValue(value.getValue())); String actualValueAsString = df.format(actualValue); String displayedValue; try { displayedValue = doc.getText(0, doc.getLength()); } catch (BadLocationException e) { displayedValue = ""; } if (displayedValue.isEmpty()) { displayedValue = "0"; } double displayedValueAsDouble = Double.parseDouble(displayedValue); if (!actualValueAsString.equals(displayedValue) && displayedValueAsDouble != actualValue) // Allow user to enter trailing zeroes. { bypassFilterAndSetText(doc, actualValueAsString); } } catch (NumberFormatException e) { // Swallow it as it's OK for the user to try and enter non-numbers. } }
public void unbindKey(String keySequence) { KeyStroke ks = KeyStroke.getKeyStroke(keySequence); if (ks == null) { throw new Error("Invalid key sequence \"" + keySequence + "\""); } textView.getKeymap().removeKeyStrokeBinding(ks); }
public void evaluate() { try { // clear problems and console messages problemsView.setText(""); consoleView.setText(""); // update status view statusView.setText(" Parsing ..."); tabbedPane.setSelectedIndex(0); LispExpr root = Parser.parse(textView.getText()); statusView.setText(" Running ..."); tabbedPane.setSelectedIndex(1); // update run button runButton.setIcon(stopImage); runButton.setActionCommand("Stop"); // start run thread runThread = new RunThread(root); runThread.start(); } catch (SyntaxError e) { tabbedPane.setSelectedIndex(0); System.err.println( "Syntax Error at " + e.getLine() + ", " + e.getColumn() + " : " + e.getMessage()); } catch (Error e) { // parsing error System.err.println(e.getMessage()); statusView.setText(" Errors."); } }
private boolean checkForSave() { // build warning message String message; if (file == null) { message = "File has been modified. Save changes?"; } else { message = "File \"" + file.getName() + "\" has been modified. Save changes?"; } // show confirm dialog int r = JOptionPane.showConfirmDialog( this, new JLabel(message), "Warning!", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (r == JOptionPane.YES_OPTION) { // Save File if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { // write the file physWriteTextFile(fileChooser.getSelectedFile(), textView.getText()); } else { // user cancelled save after all return false; } } return r != JOptionPane.CANCEL_OPTION; }
public void bindKeyToCommand(String keySequence, LispExpr cmd) { // see Java API for info on keySequence format KeyStroke ks = KeyStroke.getKeyStroke(keySequence); if (ks == null) { throw new Error("Invalid key sequence \"" + keySequence + "\""); } textView.getKeymap().addActionForKeyStroke(ks, new KeyAction(cmd)); }
private void _setTagForSelectedText(String tagElement) { try { System.out.println(mTextEditor.getText()); } catch (Exception e) { e.printStackTrace(); } }
private JPanel createCentrePanel(YDataStateException exception) { JPanel centrePanel = new JPanel(new GridLayout(1, 2)); JPanel msgPanel = new JPanel(new BorderLayout()); msgPanel.setBackground(YAdminGUI._apiColour); msgPanel.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Schema for completing task"), BorderFactory.createEmptyBorder(10, 10, 10, 10))); JTextPane msgTextPane = new JTextPane(); msgTextPane.setContentType("text/plain"); msgTextPane.setFont(new Font("courier", Font.PLAIN, 12)); msgTextPane.setForeground(Color.RED); msgTextPane.setText(exception.getMessage()); msgTextPane.setEditable(false); msgTextPane.setBackground(Color.LIGHT_GRAY); JPanel noWrapPanel = new JPanel(); noWrapPanel.setLayout(new BorderLayout()); noWrapPanel.add(msgTextPane); msgPanel.add(new JScrollPane(noWrapPanel)); centrePanel.add(msgPanel, BorderLayout.NORTH); return centrePanel; }
void editorPane_keyPressed(KeyEvent e) { StyledDocument doc = editorPane.getStyledDocument(); int pos = editorPane.getCaretPosition(); int code = e.getKeyCode(); Element el; switch (code) { case KeyEvent.VK_BACK_SPACE: case KeyEvent.VK_DELETE: case KeyEvent.VK_LEFT: case KeyEvent.VK_KP_LEFT: if (pos == 0) return; // we want to get the element to the left of position. el = doc.getCharacterElement(pos - 1); break; case KeyEvent.VK_RIGHT: case KeyEvent.VK_KP_RIGHT: // we want to get the element to the right of position. el = doc.getCharacterElement(pos + 1); break; default: return; // bail we don't handle it. } AttributeSet attr = el.getAttributes(); String el_name = (String) attr.getAttribute(StyleConstants.NameAttribute); int el_range = el.getEndOffset() - el.getStartOffset() - 1; if (el_name.startsWith("Parameter") && StyleConstants.getComponent(attr) != null) { try { switch (code) { case KeyEvent.VK_BACK_SPACE: case KeyEvent.VK_DELETE: doc.remove(el.getStartOffset(), el_range); break; case KeyEvent.VK_LEFT: case KeyEvent.VK_KP_LEFT: editorPane.setCaretPosition(pos - el_range); break; case KeyEvent.VK_RIGHT: case KeyEvent.VK_KP_RIGHT: editorPane.setCaretPosition(pos + (el_range)); break; } } catch (BadLocationException ex) { } } }
// Appends text to the end of the log, using the provided settings. Doesn't add a new line. private static void print(String message, SimpleAttributeSet settings) { try { outputText .getDocument() .insertString(outputText.getDocument().getLength(), message, settings); } catch (BadLocationException e) { try { outputText .getDocument() .insertString( outputText.getDocument().getLength(), "Couldn't insert message \"" + message + "\".", progErr); } catch (BadLocationException b) { // If you ever reach this error, something is seriously wrong, so just please swallow it and // ignore it. } } }
/** * Sets the reason of a call failure if one occurs. The renderer should display this reason to the * user. * * @param reason the reason to display */ public void setErrorReason(final String reason) { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater( new Runnable() { public void run() { setErrorReason(reason); } }); return; } if (errorMessageComponent == null) { errorMessageComponent = new JTextPane(); JTextPane textPane = (JTextPane) errorMessageComponent; textPane.setEditable(false); textPane.setOpaque(false); StyledDocument doc = textPane.getStyledDocument(); MutableAttributeSet standard = new SimpleAttributeSet(); StyleConstants.setAlignment(standard, StyleConstants.ALIGN_CENTER); StyleConstants.setFontFamily(standard, textPane.getFont().getFamily()); StyleConstants.setFontSize(standard, 12); doc.setParagraphAttributes(0, 0, standard, true); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 4; constraints.weightx = 1; constraints.weighty = 0; constraints.insets = new Insets(5, 0, 0, 0); add(errorMessageComponent, constraints); this.revalidate(); } errorMessageComponent.setText(reason); if (isVisible()) errorMessageComponent.repaint(); }
public void newFile() { if (!dirty || checkForSave()) { textView.setText(""); consoleView.setText(""); problemsView.setText(""); statusView.setText(" Created new file."); file = null; // reset dirty bit dirty = false; } }
public void saveFile() { if (file == null) { // first save file, so prompt for name. saveFileAs(); } else { // file already named so just write it. physWriteTextFile(file, textView.getText()); // update status statusView.setText(" Saved file \"" + file.getName() + "\"."); // reset dirty bit dirty = false; } }
public MonitorGUI(final PhoneCallMonitor pcm, String title) { this.pcm = pcm; text.setFont(new Font("Courier", Font.PLAIN, 12)); text.setText(title); JPanel buttons = new JPanel(); buttons.setLayout(new GridLayout(1, 0)); button = new JButton( new AbstractAction("Pick Up" /*,new JarImageIcon(getClass(),"32x32/play.png")*/) { public void actionPerformed(ActionEvent ev) { button.setEnabled(false); pcm.pickup(); } }); buttons.add(button); setLayout(new BorderLayout()); add(new JScrollPane(text), BorderLayout.CENTER); add(buttons, BorderLayout.SOUTH); }
public void caretUpdate(CaretEvent e) { // when the cursor moves on _textView // this method will be called. Then, we // must determine what the line number is // and update the line number view Element root = textView.getDocument().getDefaultRootElement(); int line = root.getElementIndex(e.getDot()); root = root.getElement(line); int col = root.getElementIndex(e.getDot()); lineNumberView.setText(line + ":" + col); // if text is selected then enable copy and cut boolean isSelection = e.getDot() != e.getMark(); copyAction.setEnabled(isSelection); cutAction.setEnabled(isSelection); }
public void saveFileAs() { // Force user to enter new file name if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { file = fileChooser.getSelectedFile(); } else { // user cancelled save after all return; } // file selected, so write it. physWriteTextFile(file, textView.getText()); // update status statusView.setText(" Saved file \"" + file.getName() + "\"."); // reset dirty bit dirty = false; }
public void openFile() { if (!dirty || checkForSave()) { if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { file = fileChooser.getSelectedFile(); } else { // user cancelled open after all return; } // load file into text view textView.setText(physReadTextFile(file)); // update status statusView.setText(" Loaded file \"" + file.getName() + "\"."); // reset dirty bit dirty = false; } }
private void _setUpEvents() { mHeadingComboBox.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent itemEvent) { if (itemEvent.getStateChange() == ItemEvent.SELECTED) { String key = itemEvent.getItem().toString(); Integer fontSize = HEADING_LIST.get(key); Font cFont = mTextEditor.getFont(); Font font = new Font(cFont.getFamily(), cFont.getStyle(), fontSize); _applyFontStyleForSelection(font); } } }); mTextEditor.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent keyEvent) {} public void keyPressed(KeyEvent keyEvent) {} public void keyReleased(KeyEvent keyEvent) { if (keyEvent.isControlDown() && keyEvent.getKeyCode() == KeyEvent.VK_B) { Font font = new Font(mTextEditor.getFont().getFamily(), Font.BOLD, 12); _applyFontStyleForSelection(font); CharArrayWriter caw = new CharArrayWriter(); try { mTextEditor.write(caw); MutableAttributeSet set = mTextEditor.getInputAttributes(); Enumeration e = set.getAttributeNames(); while (e.hasMoreElements()) { try { StyleConstants.FontConstants at = (StyleConstants.FontConstants) e.nextElement(); } catch (Exception ex) { ex.printStackTrace(); } } System.out.println(caw.toString()); } catch (IOException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | // File Templates. } } } }); }
private void insertParameter(ConfigParamDescr descr, String format, int pos) { try { StyledDocument doc = (StyledDocument) editorPane.getDocument(); // The component must first be wrapped in a style Style style = doc.addStyle("Parameter-" + numParameters, null); JLabel label = new JLabel(descr.getDisplayName()); label.setAlignmentY(0.8f); // make sure we line up label.setFont(new Font("Helvetica", Font.PLAIN, 14)); label.setForeground(Color.BLUE); label.setName(descr.getKey()); label.setToolTipText("key: " + descr.getKey() + " format: " + format); StyleConstants.setComponent(style, label); doc.insertString(pos, format, style); numParameters++; } catch (BadLocationException e) { } }
void insertMatchButton_actionPerformed(ActionEvent e) { String key = (String) matchComboBox.getSelectedItem(); String format = (String) matchesKeys.get(key); if (key.equals(STRING_LITERAL)) { format = escapeReservedChars( (String) JOptionPane.showInputDialog( this, "Enter the string you wish to match", "String Literal Input", JOptionPane.OK_CANCEL_OPTION)); if (StringUtil.isNullString(format)) { return; } } if (selectedPane == 0) { insertText(format, PLAIN_ATTR, editorPane.getSelectionStart()); } else { // add the combobox data value to the edit box int pos = formatTextArea.getCaretPosition(); formatTextArea.insert(format, pos); } }
protected void buildErrorPanel() { errorPanel = new JPanel(); GroupLayout layout = new GroupLayout(errorPanel); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); errorPanel.setLayout(layout); // errorPanel.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK)); errorMessage = new JTextPane(); errorMessage.setEditable(false); errorMessage.setContentType("text/html"); errorMessage.setText( "<html><body>Could not connect to the Processing server.<br>" + "Contributions cannot be installed or updated without an Internet connection.<br>" + "Please verify your network connection again, then try connecting again.</body></html>"); errorMessage.setFont(Toolkit.getSansFont(14, Font.PLAIN)); errorMessage.setMaximumSize(new Dimension(550, 50)); errorMessage.setOpaque(false); StyledDocument doc = errorMessage.getStyledDocument(); SimpleAttributeSet center = new SimpleAttributeSet(); StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER); doc.setParagraphAttributes(0, doc.getLength(), center, false); closeButton = new JButton("X"); closeButton.setContentAreaFilled(false); closeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { contribDialog.makeAndShowTab(false, false); } }); tryAgainButton = new JButton("Try Again"); tryAgainButton.setFont(Toolkit.getSansFont(14, Font.PLAIN)); tryAgainButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { contribDialog.makeAndShowTab(false, true); contribDialog.downloadAndUpdateContributionListing(editor.getBase()); } }); layout.setHorizontalGroup( layout .createSequentialGroup() .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(errorMessage) .addComponent( tryAgainButton, StatusPanel.BUTTON_WIDTH, StatusPanel.BUTTON_WIDTH, StatusPanel.BUTTON_WIDTH)) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(closeButton)); layout.setVerticalGroup( layout .createSequentialGroup() .addGroup( layout.createParallelGroup().addComponent(errorMessage).addComponent(closeButton)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(tryAgainButton)); errorPanel.setBackground(Color.PINK); errorPanel.validate(); }
/** * Creates an instance of <tt>ShowPreviewDialog</tt> * * @param chatPanel The <tt>ChatConversationPanel</tt> that is associated with this dialog. */ ShowPreviewDialog(final ChatConversationPanel chatPanel) { this.chatPanel = chatPanel; this.setTitle( GuiActivator.getResources().getI18NString("service.gui.SHOW_PREVIEW_DIALOG_TITLE")); okButton = new JButton(GuiActivator.getResources().getI18NString("service.gui.OK")); cancelButton = new JButton(GuiActivator.getResources().getI18NString("service.gui.CANCEL")); JPanel mainPanel = new TransparentPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // mainPanel.setPreferredSize(new Dimension(200, 150)); this.getContentPane().add(mainPanel); JTextPane descriptionMsg = new JTextPane(); descriptionMsg.setEditable(false); descriptionMsg.setOpaque(false); descriptionMsg.setText( GuiActivator.getResources().getI18NString("service.gui.SHOW_PREVIEW_WARNING_DESCRIPTION")); Icon warningIcon = null; try { warningIcon = new ImageIcon( ImageIO.read( GuiActivator.getResources().getImageURL("service.gui.icons.WARNING_ICON"))); } catch (IOException e) { logger.debug("failed to load the warning icon"); } JLabel warningSign = new JLabel(warningIcon); JPanel warningPanel = new TransparentPanel(); warningPanel.setLayout(new BoxLayout(warningPanel, BoxLayout.X_AXIS)); warningPanel.add(warningSign); warningPanel.add(Box.createHorizontalStrut(10)); warningPanel.add(descriptionMsg); enableReplacement = new JCheckBox( GuiActivator.getResources() .getI18NString("plugin.chatconfig.replacement.ENABLE_REPLACEMENT_STATUS")); enableReplacement.setOpaque(false); enableReplacement.setSelected(cfg.getBoolean(ReplacementProperty.REPLACEMENT_ENABLE, true)); enableReplacementProposal = new JCheckBox( GuiActivator.getResources() .getI18NString("plugin.chatconfig.replacement.ENABLE_REPLACEMENT_PROPOSAL")); enableReplacementProposal.setOpaque(false); JPanel checkBoxPanel = new TransparentPanel(); checkBoxPanel.setLayout(new BoxLayout(checkBoxPanel, BoxLayout.Y_AXIS)); checkBoxPanel.add(enableReplacement); checkBoxPanel.add(enableReplacementProposal); JPanel buttonsPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER)); buttonsPanel.add(okButton); buttonsPanel.add(cancelButton); mainPanel.add(warningPanel); mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(checkBoxPanel); mainPanel.add(buttonsPanel); okButton.addActionListener(this); cancelButton.addActionListener(this); this.setPreferredSize(new Dimension(390, 230)); }
public void actionPerformed(ActionEvent e) { textView.paste(); }
private JTextPane makeTextPane(boolean editable) { document = new DefaultStyledDocument(); JTextPane ta = new JTextPane(document); ta.setEditable(editable); return ta; }