mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
clean up some button and text field placement issues with osx
This commit is contained in:
@@ -41,9 +41,11 @@ public class EditorButtons extends JComponent implements MouseInputListener {
|
||||
};
|
||||
|
||||
static final int BUTTON_COUNT = title.length;
|
||||
static final int BUTTON_WIDTH = 27; //Preferences.GRID_SIZE;
|
||||
static final int BUTTON_HEIGHT = 32; //Preferences.GRID_SIZE;
|
||||
static final int BUTTON_GAP = 15; //BUTTON_WIDTH / 2;
|
||||
/// height, width of the toolbar buttons
|
||||
static final int BUTTON_WIDTH = 27;
|
||||
static final int BUTTON_HEIGHT = 32;
|
||||
/// amount of space between groups of buttons on the toolbar
|
||||
static final int BUTTON_GAP = 15;
|
||||
|
||||
static final int RUN = 0;
|
||||
static final int STOP = 1;
|
||||
|
||||
+11
-6
@@ -373,18 +373,23 @@ public class EditorStatus extends JPanel implements ActionListener {
|
||||
int noLeft = cancelLeft - eachButton;
|
||||
int yesLeft = noLeft - eachButton;
|
||||
|
||||
System.out.println("setting button height to " + Preferences.BUTTON_HEIGHT);
|
||||
yesButton.setLocation(yesLeft, top);
|
||||
noButton.setLocation(noLeft, top);
|
||||
cancelButton.setLocation(cancelLeft, top);
|
||||
editField.setLocation(yesLeft - Preferences.BUTTON_WIDTH, top);
|
||||
okButton.setLocation(noLeft, top);
|
||||
|
||||
yesButton.setSize( Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
|
||||
noButton.setSize( Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
|
||||
yesButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
|
||||
noButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
|
||||
cancelButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
|
||||
okButton.setSize( Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
|
||||
editField.setSize( 2*Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
|
||||
okButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
|
||||
|
||||
// edit field height is awkward, and very different between mac and pc,
|
||||
// so use at least the preferred height for now.
|
||||
int editWidth = 2*Preferences.BUTTON_WIDTH;
|
||||
int editHeight = editField.getPreferredSize().height;
|
||||
int editTop = (1 + sizeH - editHeight) / 2; // add 1 for ceil
|
||||
editField.setBounds(yesLeft - Preferences.BUTTON_WIDTH, editTop,
|
||||
editWidth, editHeight);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+15
-3
@@ -71,11 +71,23 @@ public class Preferences extends JComponent {
|
||||
static final String PROMPT_OK = "OK";
|
||||
static final String PROMPT_BROWSE = "Browse";
|
||||
|
||||
// mac needs it to be 70, windows needs 66, linux needs 76
|
||||
/**
|
||||
* Standardized width for buttons. Mac OS X 10.3 wants 70 as its default,
|
||||
* Windows XP needs 66, and Linux needs 76, so 76 seems proper.
|
||||
*/
|
||||
static int BUTTON_WIDTH = 76;
|
||||
|
||||
//
|
||||
/**
|
||||
* Standardized button height. Mac OS X 10.3 (Java 1.4) wants 29,
|
||||
* presumably because it now includes the blue border, where it didn't
|
||||
* in Java 1.3. Windows XP only wants 23 (not sure what default Linux
|
||||
* would be). Because of the disparity, on Mac OS X, it will be set
|
||||
* inside a static block.
|
||||
*/
|
||||
static int BUTTON_HEIGHT = 24;
|
||||
static {
|
||||
if (Base.isMacOS()) BUTTON_HEIGHT = 29;
|
||||
}
|
||||
|
||||
// value for the size bars, buttons, etc
|
||||
|
||||
@@ -375,7 +387,7 @@ public class Preferences extends JComponent {
|
||||
pain.add(button);
|
||||
d2 = button.getPreferredSize();
|
||||
BUTTON_HEIGHT = d2.height;
|
||||
System.out.println("changing button height to " + BUTTON_HEIGHT);
|
||||
//System.out.println("changing button height to " + BUTTON_HEIGHT);
|
||||
|
||||
// smoosh up to the line before
|
||||
//top -= BUTTON_HEIGHT;
|
||||
|
||||
Reference in New Issue
Block a user