mirror of
https://github.com/processing/processing4.git
synced 2026-02-16 11:55:38 +01:00
Add option to not embed the Java runtime
This commit is contained in:
@@ -266,7 +266,9 @@ public class JavaEditor extends Editor {
|
||||
label2.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
panel.add(label1);
|
||||
panel.add(label2);
|
||||
int wide = label1.getPreferredSize().width;
|
||||
// The longer line is different between Windows and OS X.
|
||||
int wide = Math.max(label1.getPreferredSize().width,
|
||||
label2.getPreferredSize().width);
|
||||
panel.add(Box.createVerticalStrut(12));
|
||||
|
||||
/*
|
||||
@@ -312,6 +314,9 @@ public class JavaEditor extends Editor {
|
||||
panel.add(platformPanel);
|
||||
*/
|
||||
|
||||
//int indent = new JCheckBox().getPreferredSize().width;
|
||||
int indent = 0;
|
||||
|
||||
final JCheckBox showStopButton = new JCheckBox("Show a Stop button");
|
||||
showStopButton.setSelected(Preferences.getBoolean("export.application.stop"));
|
||||
showStopButton.addItemListener(new ItemListener() {
|
||||
@@ -320,7 +325,7 @@ public class JavaEditor extends Editor {
|
||||
}
|
||||
});
|
||||
showStopButton.setEnabled(Preferences.getBoolean("export.application.fullscreen"));
|
||||
showStopButton.setBorder(new EmptyBorder(3, 13, 6, 13));
|
||||
showStopButton.setBorder(new EmptyBorder(3, 13 + indent, 6, 13));
|
||||
|
||||
final JCheckBox fullScreenButton = new JCheckBox("Full Screen (Present mode)");
|
||||
fullScreenButton.setSelected(Preferences.getBoolean("export.application.fullscreen"));
|
||||
@@ -333,10 +338,33 @@ public class JavaEditor extends Editor {
|
||||
});
|
||||
fullScreenButton.setBorder(new EmptyBorder(3, 13, 3, 13));
|
||||
|
||||
boolean embed = Preferences.getBoolean("export.application.embed_java");
|
||||
final String embedWarning = "Embedding Java makes larger applications";
|
||||
final String nopeWarning = "Users will have to install the latest Java 7";
|
||||
final JLabel warningLabel = new JLabel(embed ? embedWarning : nopeWarning);
|
||||
warningLabel.setBorder(new EmptyBorder(3, 13 + indent, 3, 13));
|
||||
|
||||
final JCheckBox embedJavaButton = new JCheckBox("Embed Java");
|
||||
embedJavaButton.setSelected(embed);
|
||||
embedJavaButton.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
boolean selected = embedJavaButton.isSelected();
|
||||
Preferences.setBoolean("export.application.embed_java", selected);
|
||||
if (selected) {
|
||||
warningLabel.setText(embedWarning);
|
||||
} else {
|
||||
warningLabel.setText(nopeWarning);
|
||||
}
|
||||
}
|
||||
});
|
||||
embedJavaButton.setBorder(new EmptyBorder(3, 13, 3, 13));
|
||||
|
||||
JPanel optionPanel = new JPanel();
|
||||
optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.Y_AXIS));
|
||||
optionPanel.add(fullScreenButton);
|
||||
optionPanel.add(showStopButton);
|
||||
optionPanel.add(embedJavaButton);
|
||||
optionPanel.add(warningLabel);
|
||||
optionPanel.setBorder(new TitledBorder("Options"));
|
||||
// wide = Math.max(wide, platformPanel.getPreferredSize().width);
|
||||
optionPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
@@ -351,7 +379,7 @@ public class JavaEditor extends Editor {
|
||||
// good = new Dimension(wide, platformPanel.getPreferredSize().height);
|
||||
// platformPanel.setMaximumSize(good);
|
||||
good = new Dimension(wide, optionPanel.getPreferredSize().height);
|
||||
optionPanel.setMaximumSize(good);
|
||||
// optionPanel.setMaximumSize(good);
|
||||
|
||||
String[] options = { "Export", "Cancel" };
|
||||
final JOptionPane optionPane = new JOptionPane(panel,
|
||||
|
||||
Reference in New Issue
Block a user