From 4787a3bd86bab34519c8e234277155026dbe28e1 Mon Sep 17 00:00:00 2001 From: benfry Date: Wed, 12 Nov 2003 01:54:14 +0000 Subject: [PATCH] things working a little better --- processing/app/PdeEditor.java | 3 +- processing/app/PdeEditorStatus.java | 2 +- processing/app/PdePreferences.java | 70 ++++++++++++++++++----------- 3 files changed, 45 insertions(+), 30 deletions(-) diff --git a/processing/app/PdeEditor.java b/processing/app/PdeEditor.java index d2f3bcbd5..97aa1b185 100644 --- a/processing/app/PdeEditor.java +++ b/processing/app/PdeEditor.java @@ -136,6 +136,7 @@ public class PdeEditor extends JFrame public PdeEditor() { + super(WINDOW_TITLE + " - " + PdeBase.VERSION); // this is needed by just about everything else preferences = new PdePreferences(); @@ -1488,7 +1489,6 @@ public class PdeEditor extends JFrame protected void skNew2() { try { - System.out.println("skNew2()"); // does all the plumbing to create a new project // then calls handleOpen to load it up @@ -1509,7 +1509,6 @@ public class PdeEditor extends JFrame sketchDir = new File(sketchParentDir, sketchName); } else { - System.out.println("this is the thing"); String sketchParentDir = PdePreferences.get("sketchbook.path"); int index = 0; diff --git a/processing/app/PdeEditorStatus.java b/processing/app/PdeEditorStatus.java index 5ed5afb18..b15ef11df 100644 --- a/processing/app/PdeEditorStatus.java +++ b/processing/app/PdeEditorStatus.java @@ -370,7 +370,7 @@ public class PdeEditorStatus extends JPanel implements ActionListener { //if (screen == null) return; if (yesButton == null) setup(); - System.out.println("status.paintComponent"); + //System.out.println("status.paintComponent"); Dimension size = getSize(); if ((size.width != sizeW) || (size.height != sizeH)) { diff --git a/processing/app/PdePreferences.java b/processing/app/PdePreferences.java index 7d50a72ee..7c89ddb48 100644 --- a/processing/app/PdePreferences.java +++ b/processing/app/PdePreferences.java @@ -73,8 +73,8 @@ public class PdePreferences extends JComponent { // mac needs it to be 70, windows needs 66, linux needs 76 - static final int BUTTON_WIDTH = 76; - static final int BUTTON_HEIGHT = 24; + static /*final*/ int BUTTON_WIDTH = 76; + static /*final*/ int BUTTON_HEIGHT = 24; // value for the size bars, buttons, etc @@ -84,7 +84,7 @@ public class PdePreferences extends JComponent { // gui variables static final int GUI_BIG = 13; - static final int GUI_BETWEEN = 13; + static final int GUI_BETWEEN = 10; static final int GUI_SMALL = 6; // gui elements @@ -220,15 +220,18 @@ public class PdePreferences extends JComponent { top += d.height + GUI_BETWEEN; - // Sketchbook location: [...............................] [ Browse ] + // Sketchbook location: + // [...............................] [ Browse ] label = new JLabel("Sketchbook location:"); pain.add(label); d = label.getPreferredSize(); + label.setBounds(left, top, d.width, d.height); + top += d.height; // + GUI_SMALL; - sketchbookLocationField = new JTextField(18); + sketchbookLocationField = new JTextField(30); pain.add(sketchbookLocationField); - d2 = sketchbookLocationField.getPreferredSize(); + d = sketchbookLocationField.getPreferredSize(); button = new JButton(PROMPT_BROWSE); button.addActionListener(new ActionListener() { @@ -245,20 +248,21 @@ public class PdePreferences extends JComponent { } }); pain.add(button); - d3 = button.getPreferredSize(); + d2 = button.getPreferredSize(); // take max height of all components to vertically align em - vmax = Math.max(Math.max(d.height, d2.height), d3.height); - label.setBounds(left, top + (vmax-d.height)/2, - d.width, d.height); - h = left + d.width + GUI_BETWEEN; - sketchbookLocationField.setBounds(h, top + (vmax-d2.height)/2, - d2.width, d2.height); - h += d2.width + GUI_BETWEEN; - button.setBounds(h, top + (vmax-d3.height)/2, - d3.width, d3.height); + vmax = Math.max(d.height, d2.height); + //label.setBounds(left, top + (vmax-d.height)/2, + // d.width, d.height); - right = Math.max(right, h + d3.width + GUI_BIG); + //h = left + d.width + GUI_BETWEEN; + sketchbookLocationField.setBounds(left, top + (vmax-d.height)/2, + d.width, d.height); + h = left + d.width + GUI_SMALL; //GUI_BETWEEN; + button.setBounds(h, top + (vmax-d2.height)/2, + d2.width, d2.height); + + right = Math.max(right, h + d2.width + GUI_BIG); top += vmax + GUI_BETWEEN; @@ -285,23 +289,29 @@ public class PdePreferences extends JComponent { // More preferences are in the ... String blather = - "More preferences are in the 'lib' folder inside text files\n" + - "named pde.properties and pde_" + - PdeBase.platforms[PdeBase.platform] + ".properties"; + "More preferences can be edited directly\n" + + "in the file " + preferencesFile.getAbsolutePath(); + //"More preferences are in the 'lib' folder inside text files\n" + + //"named pde.properties and pde_" + + //PdeBase.platforms[PdeBase.platform] + ".properties"; JTextArea textarea = new JTextArea(blather); - textarea.setBorder(new EmptyBorder(GUI_SMALL, GUI_SMALL, GUI_SMALL, GUI_SMALL)); + textarea.setEditable(false); + textarea.setBorder(new EmptyBorder(0, 0, 0, 0)); + textarea.setBackground(null); textarea.setFont(new Font("Dialog", Font.PLAIN, 12)); pain.add(textarea); - //pain.add(label); d = textarea.getPreferredSize(); textarea.setBounds(left, top, d.width, d.height); - top += d.height + GUI_BETWEEN; + top += d.height; // + GUI_BETWEEN; // [ OK ] [ Cancel ] maybe these should be next to the message? + right = Math.max(right, left + d.width + GUI_BETWEEN + + BUTTON_WIDTH + GUI_SMALL + BUTTON_WIDTH); + button = new JButton(PROMPT_OK); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -310,10 +320,15 @@ public class PdePreferences extends JComponent { } }); pain.add(button); - button.setBounds(left, top, BUTTON_WIDTH, BUTTON_HEIGHT); - h = left + BUTTON_WIDTH + GUI_BETWEEN; + d2 = button.getPreferredSize(); + BUTTON_HEIGHT = d2.height; - //d = button.getPreferredSize(); + // smoosh up to the line before + top -= BUTTON_HEIGHT; + + h = right - (BUTTON_WIDTH + GUI_SMALL + BUTTON_WIDTH); + button.setBounds(h, top, BUTTON_WIDTH, BUTTON_HEIGHT); + h += BUTTON_WIDTH + GUI_SMALL; button = new JButton(PROMPT_CANCEL); button.addActionListener(new ActionListener() { @@ -326,7 +341,8 @@ public class PdePreferences extends JComponent { top += BUTTON_HEIGHT + GUI_BETWEEN; - // + + // finish up wide = right + GUI_BIG; high = top + GUI_BIG;