mirror of
https://github.com/nasa/trick.git
synced 2025-06-01 23:20:59 +00:00
Turned on look and feel for tv (#1861)
* Turned on look and feel option for tv Turned on look and feel option for tv * Removed one import added by accident Removed one import added by accident
This commit is contained in:
parent
3cc4441f6a
commit
aa2e108ea1
@ -464,11 +464,6 @@ public abstract class RunTimeTrickApplication extends TrickApplication {
|
|||||||
JMenuBar menuBar = super.createMenuBar();
|
JMenuBar menuBar = super.createMenuBar();
|
||||||
JMenu menu = menuBar.getMenu(0);
|
JMenu menu = menuBar.getMenu(0);
|
||||||
|
|
||||||
// Remove look and feel menu item.
|
|
||||||
for (int i = 0; i < 2; ++i) {
|
|
||||||
menu.remove(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
menu.add(new JSeparator(), 0);
|
menu.add(new JSeparator(), 0);
|
||||||
|
|
||||||
menu.add(new JMenuItem(new AbstractAction("Settings") {
|
menu.add(new JMenuItem(new AbstractAction("Settings") {
|
||||||
|
@ -10,6 +10,7 @@ import java.awt.Desktop;
|
|||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
|
import java.awt.Window;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -274,7 +275,13 @@ public abstract class TrickApplication extends SingleFrameApplication implements
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
UIManager.setLookAndFeel(finalLafClassName);
|
UIManager.setLookAndFeel(finalLafClassName);
|
||||||
SwingUtilities.updateComponentTreeUI(getMainFrame());
|
// update the UI for all windows with the new look and feel
|
||||||
|
// this is needed for all the windows that are not
|
||||||
|
// children of the main frame as well as the children
|
||||||
|
// of the main frame
|
||||||
|
for (Window window : Window.getWindows()) {
|
||||||
|
SwingUtilities.updateComponentTreeUI(window);
|
||||||
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
JOptionPane.showMessageDialog(getMainFrame(),
|
JOptionPane.showMessageDialog(getMainFrame(),
|
||||||
"Can't change look and feel",
|
"Can't change look and feel",
|
||||||
|
@ -405,7 +405,12 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
|
|
||||||
// Initialze the variable tree.
|
// Initialze the variable tree.
|
||||||
variableTree = new TVVariableTree() {{
|
variableTree = new TVVariableTree() {{
|
||||||
setEnabled(false);
|
// don't disable it here due to a known issue with the Apple Aqua Look and Feel
|
||||||
|
// when using custom Look and Feel components on Mac. The NullPointerException
|
||||||
|
// occurs in the AquaMenuPainter class when it tries to paint a border but
|
||||||
|
// gets a null value from com.apple.laf.AquaMenuPainter$RecyclableBorder.get()
|
||||||
|
// returns null
|
||||||
|
// setEnabled(false);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setSorting(Enum.valueOf(Sorting.class, trickProperties.getProperty(
|
setSorting(Enum.valueOf(Sorting.class, trickProperties.getProperty(
|
||||||
@ -440,7 +445,14 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
searchPanel = new SearchPanel() {{
|
searchPanel = new SearchPanel() {{
|
||||||
setVisible(Boolean.parseBoolean(trickProperties.getProperty(
|
setVisible(Boolean.parseBoolean(trickProperties.getProperty(
|
||||||
searchPanelVisibleKey, Boolean.toString(true))));
|
searchPanelVisibleKey, Boolean.toString(true))));
|
||||||
setEnabled(false);
|
|
||||||
|
// don't disable it here due to a known issue with the Apple Aqua Look and Feel
|
||||||
|
// when using custom Look and Feel components on Mac. The NullPointerException
|
||||||
|
// occurs in the AquaMenuPainter class when it tries to paint a border but
|
||||||
|
// gets a null value from com.apple.laf.AquaMenuPainter$RecyclableBorder.get()
|
||||||
|
// returns null
|
||||||
|
// setEnabled(false);
|
||||||
|
|
||||||
setFontSize(Float.parseFloat(trickProperties.getProperty(
|
setFontSize(Float.parseFloat(trickProperties.getProperty(
|
||||||
fontSizeKey, Integer.toString(getFont().getSize()))));
|
fontSizeKey, Integer.toString(getFont().getSize()))));
|
||||||
setAction(new AbstractAction("Add") {
|
setAction(new AbstractAction("Add") {
|
||||||
@ -1933,12 +1945,6 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
return Sorting.None;
|
return Sorting.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void changeLookAndFeel(String lookAndFeelName) {
|
|
||||||
// Some of TV's elements don't respond well to look and feel changes,
|
|
||||||
// so I'm not supporting it for now.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutdown() {
|
protected void shutdown() {
|
||||||
trickProperties.setProperty(positionKey, position.toString());
|
trickProperties.setProperty(positionKey, position.toString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user