List of usage examples for java.awt GridBagConstraints EAST
int EAST
To view the source code for java.awt GridBagConstraints EAST.
Click Source Link
From source file:TextAcceleratorExample.java
public static void main(String[] args) { try {//from w w w .jav a 2 s . co m UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception evt) { } JLabel l; JTextField t; JButton b; JFrame f = new JFrame("Text Accelerator Example"); Container cp = f.getContentPane(); cp.setLayout(new GridBagLayout()); cp.setBackground(UIManager.getColor("control")); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.gridheight = 1; c.insets = new Insets(2, 2, 2, 2); c.anchor = GridBagConstraints.EAST; cp.add(l = new JLabel("Name:", SwingConstants.RIGHT), c); l.setDisplayedMnemonic('n'); cp.add(l = new JLabel("House/Street:", SwingConstants.RIGHT), c); l.setDisplayedMnemonic('h'); cp.add(l = new JLabel("City:", SwingConstants.RIGHT), c); l.setDisplayedMnemonic('c'); cp.add(l = new JLabel("State/County:", SwingConstants.RIGHT), c); l.setDisplayedMnemonic('s'); cp.add(l = new JLabel("Zip/Post code:", SwingConstants.RIGHT), c); l.setDisplayedMnemonic('z'); cp.add(l = new JLabel("Telephone:", SwingConstants.RIGHT), c); l.setDisplayedMnemonic('t'); cp.add(b = new JButton("Clear"), c); b.setMnemonic('l'); c.gridx = 1; c.gridy = 0; c.weightx = 1.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.CENTER; cp.add(t = new JTextField(35), c); t.setFocusAccelerator('n'); c.gridx = 1; c.gridy = GridBagConstraints.RELATIVE; cp.add(t = new JTextField(35), c); t.setFocusAccelerator('h'); cp.add(t = new JTextField(35), c); t.setFocusAccelerator('c'); cp.add(t = new JTextField(35), c); t.setFocusAccelerator('s'); cp.add(t = new JTextField(35), c); t.setFocusAccelerator('z'); cp.add(t = new JTextField(35), c); t.setFocusAccelerator('t'); c.weightx = 0.0; c.fill = GridBagConstraints.NONE; cp.add(b = new JButton("OK"), c); b.setMnemonic('o'); f.pack(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); f.setVisible(true); }
From source file:Main.java
public TestPane() { JLabel longText = new JLabel("Long Long Text"); JLabel shortText = new JLabel("Short"); JLabel medText = new JLabel("Medium"); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0;/*from w ww. ja va 2 s. c om*/ gbc.gridy = 0; gbc.anchor = GridBagConstraints.EAST; add(longText, gbc); addFields(gbc); gbc.gridx = 0; gbc.gridy++; gbc.anchor = GridBagConstraints.EAST; add(shortText, gbc); addFields(gbc); gbc.gridx = 0; gbc.gridy++; gbc.anchor = GridBagConstraints.EAST; add(medText, gbc); addFields(gbc); }
From source file:Main.java
public Main() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); JPanel upper = new JPanel(); GridBagLayout gridbag = new GridBagLayout(); upper.setLayout(gridbag);// w ww.java 2s . co m GridBagConstraints gbc = new GridBagConstraints(); JButton toolbar1 = new JButton("toolbar1"); JButton toolbar2 = new JButton("toolbar2"); JButton toolbar3 = new JButton("toolbar3"); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.anchor = GridBagConstraints.WEST; upper.add(toolbar1, gbc); gbc.gridx = 1; gbc.anchor = GridBagConstraints.CENTER; upper.add(toolbar2, gbc); gbc.gridx = 2; gbc.anchor = GridBagConstraints.EAST; gbc.gridwidth = GridBagConstraints.REMAINDER; upper.add(toolbar3, gbc); add(upper, BorderLayout.NORTH); JPanel something = new JPanel(); something.setBackground(Color.WHITE); something.setPreferredSize(new Dimension(600, 600)); something.repaint(); add(something, BorderLayout.CENTER); pack(); setVisible(true); }
From source file:Main.java
public LoginPanel() { setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.weightx = 1;/*from w ww . j av a 2 s . com*/ gbc.gridx = 2; gbc.anchor = GridBagConstraints.EAST; JLabel label = new JLabel("Username: "); add(label, gbc); gbc.anchor = GridBagConstraints.WEST; gbc.gridx = 3; gbc.gridwidth = 2; add(userfield, gbc); gbc.gridy = 1; add(passfield, gbc); gbc.anchor = GridBagConstraints.EAST; gbc.gridx = 2; label = new JLabel("Password: "); add(label, gbc); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridy = 2; gbc.gridx = 1; gbc.gridwidth = 5; add(new JSeparator(JSeparator.HORIZONTAL), gbc); }
From source file:EditorPaneExample3.java
public EditorPaneExample3() { super("JEditorPane Example 3"); pane = new JEditorPane(); pane.setEditable(false); // Read-only getContentPane().add(new JScrollPane(pane), "Center"); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1;//www . j a v a 2 s . c o m c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridx = 1; c.gridy = 0; c.gridwidth = 1; c.weightx = 1.0; c.fill = GridBagConstraints.HORIZONTAL; textField = new JTextField(32); panel.add(textField, c); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); getContentPane().add(panel, "South"); // Change page based on text field textField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String url = textField.getText(); try { // Try to display the page loadingState.setText("Loading..."); loadingState.paintImmediately(0, 0, loadingState.getSize().width, loadingState.getSize().height); loadedType.setText(""); loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height); pane.setPage(url); loadingState.setText("Loaded"); loadedType.setText(pane.getContentType()); } catch (IOException e) { JOptionPane.showMessageDialog(pane, new String[] { "Unable to open file", url }, "File Open Error", JOptionPane.ERROR_MESSAGE); loadingState.setText("Failed"); } } }); }
From source file:EditorPaneExample10A.java
public EditorPaneExample10A() { super("JEditorPane Example 10 - using getIterator"); pane = new JEditorPane(); pane.setEditable(false); // Read-only getContentPane().add(new JScrollPane(pane), "Center"); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1;//from www .java 2 s.c o m c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridy = 3; panel.add(new JLabel(LOAD_TIME), c); c.gridy = 4; c.gridwidth = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; onlineLoad = new JCheckBox("Online Load"); panel.add(onlineLoad, c); onlineLoad.setSelected(true); onlineLoad.setForeground(typeLabel.getForeground()); c.gridx = 1; c.gridy = 0; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; urlCombo = new JComboBox(); panel.add(urlCombo, c); urlCombo.setEditable(true); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); timeLabel = new JLabel(""); c.gridy = 3; panel.add(timeLabel, c); getContentPane().add(panel, "South"); // Change page based on combo selection urlCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (populatingCombo == true) { return; } Object selection = urlCombo.getSelectedItem(); try { // Check if the new page and the old // page are the same. URL url; if (selection instanceof URL) { url = (URL) selection; } else { url = new URL((String) selection); } URL loadedURL = pane.getPage(); if (loadedURL != null && loadedURL.sameFile(url)) { return; } // Try to display the page urlCombo.setEnabled(false); // Disable input urlCombo.paintImmediately(0, 0, urlCombo.getSize().width, urlCombo.getSize().height); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Busy cursor loadingState.setText("Loading..."); loadingState.paintImmediately(0, 0, loadingState.getSize().width, loadingState.getSize().height); loadedType.setText(""); loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height); timeLabel.setText(""); timeLabel.paintImmediately(0, 0, timeLabel.getSize().width, timeLabel.getSize().height); startTime = System.currentTimeMillis(); // Choose the loading method if (onlineLoad.isSelected()) { // Usual load via setPage pane.setPage(url); loadedType.setText(pane.getContentType()); } else { pane.setContentType("text/html"); loadedType.setText(pane.getContentType()); if (loader == null) { loader = new HTMLDocumentLoader(); } HTMLDocument doc = loader.loadDocument(url); loadComplete(); pane.setDocument(doc); displayLoadTime(); populateCombo(findLinks(doc, null)); enableInput(); } } catch (Exception e) { System.out.println(e); JOptionPane.showMessageDialog(pane, new String[] { "Unable to open file", selection.toString() }, "File Open Error", JOptionPane.ERROR_MESSAGE); loadingState.setText("Failed"); enableInput(); } } }); // Listen for page load to complete pane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("page")) { loadComplete(); displayLoadTime(); populateCombo(findLinks(pane.getDocument(), null)); enableInput(); } } }); }
From source file:EditorPaneExample4.java
public EditorPaneExample4() { super("JEditorPane Example 4"); pane = new JEditorPane(); pane.setEditable(false); // Read-only getContentPane().add(new JScrollPane(pane), "Center"); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1;/* w w w. j a v a 2s. c o m*/ c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridx = 1; c.gridy = 0; c.gridwidth = 1; c.weightx = 1.0; c.fill = GridBagConstraints.HORIZONTAL; textField = new JTextField(32); panel.add(textField, c); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); getContentPane().add(panel, "South"); // Change page based on text field textField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String url = textField.getText(); try { // Check if the new page and the old // page are the same. URL newURL = new URL(url); URL loadedURL = pane.getPage(); if (loadedURL != null && loadedURL.sameFile(newURL)) { return; } // Try to display the page textField.setEnabled(false); // Disable input textField.paintImmediately(0, 0, textField.getSize().width, textField.getSize().height); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Busy cursor loadingState.setText("Loading..."); loadingState.paintImmediately(0, 0, loadingState.getSize().width, loadingState.getSize().height); loadedType.setText(""); loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height); pane.setPage(url); loadedType.setText(pane.getContentType()); } catch (Exception e) { System.out.println(e); JOptionPane.showMessageDialog(pane, new String[] { "Unable to open file", url }, "File Open Error", JOptionPane.ERROR_MESSAGE); loadingState.setText("Failed"); textField.setEnabled(true); setCursor(Cursor.getDefaultCursor()); } } }); // Listen for page load to complete pane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("page")) { loadingState.setText("Page loaded."); textField.setEnabled(true); // Allow entry of new URL setCursor(Cursor.getDefaultCursor()); } } }); }
From source file:PizzaGridBagLayout.java
public PizzaGridBagLayout() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel1 = new JPanel(); panel1.setLayout(new GridBagLayout()); addItem(panel1, new JLabel("Name:"), 0, 0, 1, 1, GridBagConstraints.EAST); addItem(panel1, new JLabel("Phone:"), 0, 1, 1, 1, GridBagConstraints.EAST); addItem(panel1, new JLabel("Address:"), 0, 2, 1, 1, GridBagConstraints.EAST); addItem(panel1, name, 1, 0, 2, 1, GridBagConstraints.WEST); addItem(panel1, phone, 1, 1, 1, 1, GridBagConstraints.WEST); addItem(panel1, address, 1, 2, 2, 1, GridBagConstraints.WEST); Box sizeBox = Box.createVerticalBox(); ButtonGroup sizeGroup = new ButtonGroup(); sizeGroup.add(small);//from w w w . jav a 2s. co m sizeGroup.add(medium); sizeGroup.add(large); sizeBox.add(small); sizeBox.add(medium); sizeBox.add(large); sizeBox.setBorder(BorderFactory.createTitledBorder("Size")); addItem(panel1, sizeBox, 0, 3, 1, 1, GridBagConstraints.NORTH); Box styleBox = Box.createVerticalBox(); ButtonGroup styleGroup = new ButtonGroup(); styleGroup.add(thin); styleGroup.add(thick); styleBox.add(thin); styleBox.add(thick); styleBox.setBorder(BorderFactory. createTitledBorder("Style")); addItem(panel1, styleBox, 1, 3, 1, 1, GridBagConstraints.NORTH); Box topBox = Box.createVerticalBox(); ButtonGroup topGroup = new ButtonGroup(); topGroup.add(pepperoni); topGroup.add(mushrooms); topGroup.add(anchovies); topBox.add(pepperoni); topBox.add(mushrooms); topBox.add(anchovies); topBox.setBorder(BorderFactory.createTitledBorder("Toppings")); addItem(panel1, topBox, 2, 3, 1, 1, GridBagConstraints.NORTH); Box buttonBox = Box.createHorizontalBox(); buttonBox.add(okButton); buttonBox.add(Box.createHorizontalStrut(20)); buttonBox.add(closeButton); addItem(panel1, buttonBox, 2, 4, 1, 1, GridBagConstraints.NORTH); this.add(panel1); this.pack(); this.setVisible(true); }
From source file:net.sourceforge.pmd.util.designer.CreateXMLRulePanel.java
public CreateXMLRulePanel(JTextArea xpathQueryArea, CodeEditorTextPane codeEditorPane) { super();//from w w w . j a v a 2 s.com this.xpathQueryArea = xpathQueryArea; this.codeEditorPane = codeEditorPane; GridBagConstraints gbc = new GridBagConstraints(); // We use a gridbaglayout for a nice and sturdy look and feel GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; gbc.weightx = 0.5; JLabel rulenameLabel = new JLabel("Rule name : "); gbl.setConstraints(rulenameLabel, gbc); add(rulenameLabel); gbc.weightx = 0.5; gbc.anchor = GridBagConstraints.WEST; gbc.gridx = 1; gbl.setConstraints(rulenameField, gbc); add(rulenameField); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.EAST; gbc.weightx = 0.5; JLabel rulemsgLabel = new JLabel("Rule msg : "); gbl.setConstraints(rulemsgLabel, gbc); add(rulemsgLabel); gbc.gridx = 1; gbc.anchor = GridBagConstraints.WEST; gbc.weightx = 0.5; gbl.setConstraints(rulemsgField, gbc); add(rulemsgField); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.EAST; gbc.weightx = 0.5; JLabel ruledescLabel = new JLabel("Rule desc : "); gbl.setConstraints(ruledescLabel, gbc); add(ruledescLabel); gbc.gridx = 1; gbc.anchor = GridBagConstraints.WEST; gbc.weightx = 0.5; ruledescField.setLineWrap(true); gbl.setConstraints(ruledescField, gbc); add(ruledescField); gbc.gridx = 0; gbc.gridy = 3; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.NORTH; JButton createRuleBtn = new JButton("Create rule XML"); createRuleBtn.addActionListener(this); gbl.setConstraints(createRuleBtn, gbc); add(createRuleBtn); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.NORTH; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; JScrollPane ruleXMLPane = new JScrollPane(ruleXMLArea); gbl.setConstraints(ruleXMLPane, gbc); add(ruleXMLPane); repaint(); }
From source file:EditorPaneExample6.java
public EditorPaneExample6() { super("JEditorPane Example 6"); pane = new JEditorPane(); pane.setEditable(false); // Start read-only getContentPane().add(new JScrollPane(pane), "Center"); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1;/*from w w w. ja va 2 s . c o m*/ c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("File name: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridx = 1; c.gridy = 0; c.gridwidth = 1; c.weightx = 1.0; c.fill = GridBagConstraints.HORIZONTAL; textField = new JTextField(32); panel.add(textField, c); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; c.gridwidth = 2; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); // Add a "Save" button saveButton = new JButton("Save"); saveButton.setEnabled(false); c.gridwidth = 1; c.gridx = 2; c.gridy = 0; c.weightx = 0.0; panel.add(saveButton, c); getContentPane().add(panel, "South"); // Change page based on text field textField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String fileName = textField.getText().trim(); file = new File(fileName); absolutePath = file.getAbsolutePath(); String url = "file:///" + absolutePath; try { // Check if the new page and the old // page are the same. URL newURL = new URL(url); URL loadedURL = pane.getPage(); if (loadedURL != null && loadedURL.sameFile(newURL)) { return; } // Try to display the page textField.setEnabled(false); // Disable input textField.paintImmediately(0, 0, textField.getSize().width, textField.getSize().height); saveButton.setEnabled(false); saveButton.paintImmediately(0, 0, saveButton.getSize().width, saveButton.getSize().height); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Busy cursor loadingState.setText("Loading..."); loadingState.paintImmediately(0, 0, loadingState.getSize().width, loadingState.getSize().height); loadedType.setText(""); loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height); pane.setEditable(false); pane.setPage(url); loadedType.setText(pane.getContentType()); } catch (Exception e) { JOptionPane.showMessageDialog(pane, new String[] { "Unable to open file", url }, "File Open Error", JOptionPane.ERROR_MESSAGE); loadingState.setText("Failed"); textField.setEnabled(true); setCursor(Cursor.getDefaultCursor()); } } }); // Listen for page load to complete pane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("page")) { loadingState.setText("Page loaded."); textField.setEnabled(true); // Allow entry of new file name textField.requestFocus(); setCursor(Cursor.getDefaultCursor()); // Allow editing and saving if appropriate pane.setEditable(file.canWrite()); saveButton.setEnabled(file.canWrite()); } } }); // Save button saveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { String type = pane.getContentType(); OutputStream os = new BufferedOutputStream(new FileOutputStream(file + ".save")); pane.setEditable(false); textField.setEnabled(false); saveButton.setEnabled(false); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Document doc = pane.getDocument(); int length = doc.getLength(); if (type.endsWith("/rtf")) { // Saving RTF - use the OutputStream try { pane.getEditorKit().write(os, doc, 0, length); os.close(); } catch (BadLocationException ex) { } } else { // Not RTF - use a Writer. Writer w = new OutputStreamWriter(os); pane.write(w); w.close(); } } catch (IOException e) { JOptionPane.showMessageDialog(pane, new String[] { "Unable to save file", file.getAbsolutePath(), }, "File Save Error", JOptionPane.ERROR_MESSAGE); } pane.setEditable(file.canWrite()); textField.setEnabled(true); saveButton.setEnabled(file.canWrite()); setCursor(Cursor.getDefaultCursor()); } }); }