| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f442e3f commit e2b1c38
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,7 +18,6 @@ | |||
| 18 | 18 | import org.eclipse.jdt.core.dom.VariableDeclaration; | |
| 19 | 19 | ||
| 20 | 20 | import java.awt.Color; | |
| 21 | - import java.awt.Dimension; | ||
| 22 | 21 | import java.awt.EventQueue; | |
| 23 | 22 | import java.awt.GraphicsDevice; | |
| 24 | 23 | import java.awt.GraphicsEnvironment; | |
@@ -648,9 +647,7 @@ public String toString() { | |||
| 648 | 647 | } | |
| 649 | 648 | ||
| 650 | 649 | ||
| 651 | - | ||
| 652 | 650 | private class Rename { | |
| 653 | - | ||
| 654 | 651 | final JDialog window; | |
| 655 | 652 | final JTextField textField; | |
| 656 | 653 | final JLabel oldNameLabel; | |
@@ -684,26 +681,28 @@ public void componentHidden(ComponentEvent e) { | |||
| 684 | 681 | ps = null; | |
| 685 | 682 | } | |
| 686 | 683 | }); | |
| 687 | - window.setSize(250, 130); | ||
| 684 | + window.setSize(Toolkit.zoom(250, 130)); | ||
| 688 | 685 | window.setLayout(new BoxLayout(window.getContentPane(), BoxLayout.Y_AXIS)); | |
| 689 | 686 | Toolkit.setIcon(window); | |
| 690 | 687 | ||
| 688 | + final int b = Toolkit.zoom(5); | ||
| 689 | + | ||
| 691 | 690 | { // Top panel | |
| 692 | 691 | ||
| 693 | 692 | // Text field | |
| 694 | 693 | textField = new JTextField(); | |
| 695 | - textField.setPreferredSize(new Dimension(150, 60)); | ||
| 694 | + textField.setPreferredSize(Toolkit.zoom(150, 60)); | ||
| 696 | 695 | ||
| 697 | 696 | // Old name label | |
| 698 | 697 | oldNameLabel = new JLabel(); | |
| 699 | - oldNameLabel.setText("Old Name: "); | ||
| 698 | + oldNameLabel.setText("Current Name: "); | ||
| 700 | 699 | ||
| 701 | 700 | // Top panel | |
| 702 | 701 | JPanel panelTop = new JPanel(); | |
| 703 | 702 | panelTop.setLayout(new BoxLayout(panelTop, BoxLayout.Y_AXIS)); | |
| 704 | - panelTop.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); | ||
| 703 | + panelTop.setBorder(BorderFactory.createEmptyBorder(b, b, b, b)); | ||
| 705 | 704 | panelTop.add(textField); | |
| 706 | - panelTop.add(Box.createRigidArea(new Dimension(0, 10))); | ||
| 705 | + panelTop.add(Box.createRigidArea(Toolkit.zoom(0, 10))); | ||
| 707 | 706 | panelTop.add(oldNameLabel); | |
| 708 | 707 | window.add(panelTop); | |
| 709 | 708 | } | |
@@ -717,28 +716,27 @@ public void componentHidden(ComponentEvent e) { | |||
| 717 | 716 | ||
| 718 | 717 | JButton renameButton = new JButton("Rename"); | |
| 719 | 718 | renameButton.addActionListener(e -> { | |
| 720 | - if (textField.getText().length() == 0) { | ||
| 721 | - return; | ||
| 722 | - } | ||
| 723 | - String newName = textField.getText().trim(); | ||
| 724 | - boolean isNewNameValid = newName.length() >= 1 && | ||
| 725 | - newName.chars().limit(1).allMatch(Character::isUnicodeIdentifierStart) && | ||
| 726 | - newName.chars().skip(1).allMatch(Character::isUnicodeIdentifierPart); | ||
| 727 | - if (!isNewNameValid) { | ||
| 728 | - JOptionPane.showMessageDialog(new JFrame(), "'" + newName | ||
| 729 | - + "' isn't a valid name.", "Uh oh..", JOptionPane.PLAIN_MESSAGE); | ||
| 730 | - } else { | ||
| 731 | - rename(ps, binding, newName); | ||
| 732 | - window.setVisible(false); | ||
| 719 | + final String newName = textField.getText().trim(); | ||
| 720 | + if (!newName.isEmpty()) { | ||
| 721 | + if (newName.length() >= 1 && | ||
| 722 | + newName.chars().limit(1).allMatch(Character::isUnicodeIdentifierStart) && | ||
| 723 | + newName.chars().skip(1).allMatch(Character::isUnicodeIdentifierPart)) { | ||
| 724 | + rename(ps, binding, newName); | ||
| 725 | + window.setVisible(false); | ||
| 726 | + } else { | ||
| 727 | + String msg = String.format("'%s' is not a valid name", newName); | ||
| 728 | + JOptionPane.showMessageDialog(editor, msg, "Naming is Hard", | ||
| 729 | + JOptionPane.PLAIN_MESSAGE); | ||
| 730 | + } | ||
| 733 | 731 | } | |
| 734 | 732 | }); | |
| 735 | 733 | ||
| 736 | 734 | JPanel panelBottom = new JPanel(); | |
| 737 | 735 | panelBottom.setLayout(new BoxLayout(panelBottom, BoxLayout.X_AXIS)); | |
| 738 | - panelBottom.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); | ||
| 736 | + panelBottom.setBorder(BorderFactory.createEmptyBorder(b, b, b, b)); | ||
| 739 | 737 | panelBottom.add(Box.createHorizontalGlue()); | |
| 740 | 738 | panelBottom.add(showUsageButton); | |
| 741 | - panelBottom.add(Box.createRigidArea(new Dimension(15, 0))); | ||
| 739 | + panelBottom.add(Box.createRigidArea(Toolkit.zoom(15, 0))); | ||
| 742 | 740 | panelBottom.add(renameButton); | |
| 743 | 741 | window.add(panelBottom); | |
| 744 | 742 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,8 @@ X include newlines at end of files (i.e. when saving .pde files) | |||
| 12 | 12 | X https://github.com/processing/processing/issues/5327 | |
| 13 | 13 | X explanation: https://stackoverflow.com/a/729795 | |
| 14 | 14 | X http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 | |
| 15 | + X Rename dialog is unusable on high density screen | ||
| 16 | + X https://github.com/processing/processing/issues/5368 | ||
| 15 | 17 | ||
| 16 | 18 | jakub | |
| 17 | 19 | X Fix scrub comments for empty block comment /**/ | |
@@ -58,8 +60,6 @@ _ https://github.com/processing/processing/issues/3911 | |||
| 58 | 60 | ||
| 59 | 61 | _ windows defender blocks processing 3.3.6 | |
| 60 | 62 | _ https://github.com/processing/processing/issues/5329 | |
| 61 | - _ Rename dialog is unusable on high density screen | ||
| 62 | - _ https://github.com/processing/processing/issues/5368 | ||
| 63 | 63 | _ Manager fails to complete install of PythonMode when no windows open | |
| 64 | 64 | _ https://github.com/processing/processing/issues/5309 | |
| 65 | 65 | _ update to launch4j 3.11? | |
| Back | FazBrowse Home | New Git URL |
0 commit comments