项目:jdk8u-jdk
文件:MenuItemIconTest.java
public static void main(String[] args) throws Exception {
robot = new Robot();
String name = UIManager.getSystemLookAndFeelClassName();
try {
UIManager.setLookAndFeel(name);
} catch (ClassNotFoundException | InstantiationException |
illegalaccessexception | UnsupportedLookAndFeelException e) {
throw new RuntimeException("Test Failed");
}
createUI();
robot.waitForIdle();
executetest();
if (!"".equals(errorMessage)) {
throw new RuntimeException(errorMessage);
}
}
项目:openjdk-jdk10
文件:MaximizedFrameTest.java
public void init() {
JFrame.setDefaultLookAndFeelDecorated(true);
try {
UIManager.setLookAndFeel("javax.swing.plaf.Metal.MetalLookAndFeel");
} catch (ClassNotFoundException | InstantiationException |
illegalaccessexception | UnsupportedLookAndFeelException ex) {
throw new RuntimeException("Test Failed. MetalLookAndFeel not set "
+ "for frame");
}
frame = new JFrame("JFrame maximization Test");
frame.pack();
frame.setSize(450,260);
frame.setVisible(true);
}
项目:Random-Music-Generator
文件:Window.java
/**
* Initialisationsmethode,die in jedem Konstruktor benutzt wird
* @param layout
* @param panels
*/
void initialize(LayoutManager layout,ArrayList<JPanel> panels){
this.setLayout(layout);
for(JPanel panel: panels){
this.add(panel);
}
this.setTitle("Random Music Generator Canon");
this.setSize(1200,700);
//places Frame in the middle of the screen
this.setLocationRelativeto(null);
this.setResizable(true);
this.setDefaultCloSEOperation(JFrame.DO_nothing_ON_CLOSE);
this.addWindowListener(new defaultwindowListener());
//adjusting look to local system
try {
UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
} catch (ClassNotFoundException | InstantiationException
| illegalaccessexception | UnsupportedLookAndFeelException e) {
e.printstacktrace();
}
//shows the Frame on the screen
this.setVisible(true);
}
public void testSinglePlatformInstall () throws IOException,UnsupportedLookAndFeelException {
UIManager.setLookAndFeel(new MetalLookAndFeel());
InstallerRegistry regs = InstallerRegistryAccessor.prepareForUnitTest(new GeneralPlatformInstall[] {
new FileBasedplatformInstall ("FileBased1",Collections.<WizardDescriptor.Panel<WizardDescriptor>>singletonList(
new Panel ("FileBased1_panel1")
))
});
PlatformInstallIterator iterator = PlatformInstallIterator.create();
WizardDescriptor wd = new WizardDescriptor (iterator);
iterator.initialize(wd);
assertEquals("Invalid state",1,iterator.getPanelIndex());
WizardDescriptor.Panel panel = iterator.current();
assertTrue ("Invalid panel",panel instanceof LocationChooser.Panel);
((JFileChooser)panel.getComponent()).setSelectedFile(this.getworkdir()); //Select some folder
assertTrue ("LocationChooser is not valid after folder was selected",panel.isValid());
assertTrue ("Should have next panel",iterator.hasNext());
assertFalse ("Should not have prevIoUs panel",iterator.hasPrevIoUs());
iterator.nextPanel();
assertEquals("Invalid state",2,iterator.getPanelIndex());
panel = iterator.current();
assertEquals("Invalid panel","FileBased1_panel1",panel.getComponent().getName());
assertFalse ("Should not have next panel",iterator.hasNext());
assertTrue ("Should have prevIoUs panel",iterator.hasPrevIoUs());
}
项目:PMDe
文件:Main.java
public static void main(String[] args) {
if (args.length > 0) {
debug = args[0] == "-d";
}
try {
javax.swing.UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (ClassNotFoundException | InstantiationException | illegalaccessexception | UnsupportedLookAndFeelException ex) {
System.err.print(ex);
}
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler());
new Main().setVisible(true);
}
/**
* Main
*/
public static void main(String[] args) throws Exception {
try {
//UIManager.setLookAndFeel("com.jtattoo.plaf.hifi.HiFiLookAndFeel");
// Nero,troppo nero. (L'unico con i jcomboBox neri) - brutto rendering dadi/coni dadi
//UIManager.setLookAndFeel("com.jtattoo.plaf.noire.NoireLookAndFeel");
// (Nero,troppo nero. (L'unico con i jcomboBox neri))^2.Un po' più di arancione in giro,scritte più bianche
UIManager.setLookAndFeel("com.jtattoo.plaf.aluminium.AluminiumLookAndFeel");
// Grigio scuro,bottoni bocciatissimi. (forse il mio preferito? Forse serve qualcosa che faccia contrasto? boh)
} catch (ClassNotFoundException | InstantiationException | illegalaccessexception | UnsupportedLookAndFeelException ex) {
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE,null,ex);
}
StartGameGUI start = new StartGameGUI();
start.setVisible(true);
}
项目:NoMoreOversleeps
文件:Main.java
static void complain(String message) throws ClassNotFoundException,InstantiationException,illegalaccessexception,UnsupportedLookAndFeelException,IOException,URISyntaxException,InterruptedException
{
// Resort to a Swing Y/N dialog asking if the user wants to update Java.
// If they click yes,their default browser will open to the JAVA_UPDATE_URL
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
int reply = JOptionPane.showConfirmDialog(null,message,"NoMoreOversleeps",JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE);
if (reply == 0)
{
String platformCode = "";
if (PlatformData.platformType == PlatformType.WINDOWS)
{
platformCode = PlatformData.is64bitOS ? "?platform=win64" : "?platform=win32";
}
else if (PlatformData.platformType == PlatformType.MAC)
{
platformCode = "?platform=mac";
}
else
{
platformCode = "?platform=linux";
}
java.awt.Desktop.getDesktop().browse(new URI(Main.JAVA_UPDATE_URL + platformCode));
Thread.sleep(100);
}
}
项目:desktop
文件:Main.java
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available,stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | illegalaccessexception | UnsupportedLookAndFeelException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE,ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokelater(() -> {
new Main().setVisible(true);
});
}
项目:Equella
文件:BaseUtility.java
@SuppressWarnings("nls")
protected BaseUtility()
{
try
{
UIManager.setLookAndFeel(new FlatterLookAndFeel());
System.setProperty("org.apache.commons.logging.LogFactory","org.apache.commons.logging.impl.SLF4JLogFactory");
BlindSSLSocketFactory.register();
AxisProperties.setProperty("axis.socketSecureFactory","org.apache.axis.components.net.SunFakeTrustSocketFactory");
}
catch( UnsupportedLookAndFeelException e )
{
throw new RuntimeException(e);
}
data = new SharedData();
createGUI();
}
项目:NeuralNet
文件:CharRecognizer.java
public static void main(String args[]) {
//Look and Feel del sistema operativo
try {
// Set Look and Feel to "System" which means that Swing will use the
// OS's native GUI toolkit to render the application,making it look
// native
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(ClassNotFoundException | InstantiationException | illegalaccessexception | UnsupportedLookAndFeelException ex) {
System.out.println("Errore GUI: " + ex);
JOptionPane.showMessageDialog(null,"Errore GUI: " + ex);
}
/* Create and display the form */
java.awt.EventQueue.invokelater(new Runnable() {
public void run() {
new CharRecognizer().setVisible(true);
}
});
}
项目:NeuralNet
文件:CharRecognizer (1).java
public static void main(String args[]) {
//Look and Feel del sistema operativo
try {
// Set Look and Feel to "System" which means that Swing will use the
// OS's native GUI toolkit to render the application,"Errore GUI: " + ex);
}
/* Create and display the form */
java.awt.EventQueue.invokelater(new Runnable() {
public void run() {
new CharRecognizer().setVisible(true);
}
});
}
public static void main(String[] args) {
UIManager.put("swing.boldMetal",Boolean.FALSE);
jdialog.setDefaultLookAndFeelDecorated(true);
JFrame.setDefaultLookAndFeelDecorated(true);
Toolkit.getDefaultToolkit().setDynamicLayout(true);
System.setProperty("sun.awt.noerasebackground","true");
try {
UIManager.setLookAndFeel(new MetalLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
System.out.println(
"Metal Look & Feel not supported on this platform. \n"
+ "Program Terminated");
System.exit(0);
}
JFrame frame = new MetalworksFrame();
frame.setVisible(true);
}
项目:ElectroLight-Penetration-Testing
文件:Gui.java
public Gui() throws ClassNotFoundException,UnsupportedLookAndFeelException {
UIManager.setLookAndFeel(UIManager.getCrossplatformlookAndFeelClassName());
frame = new JFrame("ElectroLight Penetration Testing");
menuBar = new JMenuBar();
frame.setJMenuBar(menuBar);
JMenu mnCounterhack = new JMenu("Counter-hack");
menuBar.add(mnCounterhack);
JMenuItem mntmArpScan = new JMenuItem("ARP Scan");
mnCounterhack.add(mntmArpScan);
frame.setSize(300,200);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
frame.getContentPane().add(tabbedPane,BorderLayout.CENTER);
// Always keep the 2 following lines at the end.
//frame.pack();
frame.setVisible(true);
}
项目:FJSTSeniorProjectSpring2017
文件:LoginGUI.java
/** Creates new form WalletLoginGUI */
public LoginGUI() {
/* Set Nimbus look and feel. */
try {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | illegalaccessexception | UnsupportedLookAndFeelException e) {
System.err.println(e.getMessage());
}
initComponents();
Utils.setwindowCenterOfScreen(this);
setVisible(true);
}
项目:FJSTSeniorProjectSpring2017
文件:RegisterGUI.java
/** Creates new form RegisterGUI */
public RegisterGUI() {
/* Set Nimbus look and feel. */
try {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | illegalaccessexception | UnsupportedLookAndFeelException exception) {
java.util.logging.Logger.getLogger(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE,exception);
}
initComponents();
Utils.setwindowCenterOfScreen(this);
setVisible(true);
}
项目:Tarski
文件:Visualization.java
public JFrame getGraph() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | illegalaccessexception
| UnsupportedLookAndFeelException e1) {
e1.printstacktrace();
}
final AlloyInstance instance = StaticInstanceMaker.createInstance(this.universe);
final VizState myState = new VizState(instance);
final JFrame frame = new JFrame("Visualization");
final VizGraPHPanel graph = new VizGraPHPanel(myState,false);
frame.add(graph);
graph.alloyGetViewer().alloyRepaint();
return frame;
}
项目:Tarski
文件:BoundSelectionPage.java
private void setTheme() {
try {
/*
* Todo BUG
*
* A Fatal error occurs while setting GTK look and feel on Ubuntu 16.04
* (com.sun.java.swing.plaf.gtk.GTKLookAndFeel).
*
*/
final String LaF = UIManager.getSystemLookAndFeelClassName();
if ("com.sun.java.swing.plaf.gtk.GTKLookAndFeel".equals(LaF)) {
UIManager.setLookAndFeel(UIManager.getCrossplatformlookAndFeelClassName());
} else {
UIManager.setLookAndFeel(LaF);
}
} catch (ClassNotFoundException | InstantiationException | illegalaccessexception
| UnsupportedLookAndFeelException e1) {
e1.printstacktrace();
}
}
public static void main(String[] args) {
UIManager.put("swing.boldMetal","true");
try {
UIManager.setLookAndFeel(new MetalLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
System.out.println(
"Metal Look & Feel not supported on this platform. \n"
+ "Program Terminated");
System.exit(0);
}
JFrame frame = new MetalworksFrame();
frame.setVisible(true);
}
项目:jdk8u-jdk
文件:bug8046391.java
public static void main(String[] args) throws Exception {
OSType type = OSInfo.getoSType();
if (type != OSType.WINDOWS) {
System.out.println("This test is for Windows only... skipping!");
return;
}
SwingUtilities.invokeAndWait(() -> {
try {
UIManager.setLookAndFeel(new WindowsLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
e.printstacktrace();
}
System.out.println("Creating JFileChooser...");
JFileChooser fileChooser = new JFileChooser();
System.out.println("Test passed: chooser = " + fileChooser);
});
// Test fails if creating JFileChooser hangs
}
项目:jdk8u-jdk
文件:Test7022041.java
public static void main(String[] args) throws Exception {
UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
// try to test all installed Look and Feels
for (UIManager.LookAndFeelInfo lookAndFeel : installedLookAndFeels) {
String name = lookAndFeel.getName();
System.out.println("Testing " + name);
// Some Look and Feels work only when test is run in a GUI environment
// (GTK+ LAF is an example)
try {
UIManager.setLookAndFeel(lookAndFeel.getClassName());
checkTitleColor();
System.out.println(" titleColor test ok");
checkTitleFont();
System.out.println(" titleFont test ok");
}
catch (UnsupportedLookAndFeelException e) {
System.out.println(" Note: LookAndFeel " + name
+ " is not supported on this configuration");
}
}
}
public static void main(String[] args) {
UIManager.put("swing.boldMetal","true");
try {
UIManager.setLookAndFeel(new MetalLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
System.out.println(
"Metal Look & Feel not supported on this platform. \n"
+ "Program Terminated");
System.exit(0);
}
JFrame frame = new MetalworksFrame();
frame.setVisible(true);
}
项目:openjdk-jdk10
文件:bug8046391.java
public static void main(String[] args) throws Exception {
OSType type = OSInfo.getoSType();
if (type != OSType.WINDOWS) {
System.out.println("This test is for Windows only... skipping!");
return;
}
SwingUtilities.invokeAndWait(() -> {
try {
UIManager.setLookAndFeel(new WindowsLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
e.printstacktrace();
}
System.out.println("Creating JFileChooser...");
JFileChooser fileChooser = new JFileChooser();
System.out.println("Test passed: chooser = " + fileChooser);
});
// Test fails if creating JFileChooser hangs
}
项目:openjdk-jdk10
文件:MenuItemIconTest.java
public static void main(String[] args) throws Exception {
robot = new Robot();
String name = UIManager.getSystemLookAndFeelClassName();
try {
UIManager.setLookAndFeel(name);
} catch (ClassNotFoundException | InstantiationException |
illegalaccessexception | UnsupportedLookAndFeelException e) {
throw new RuntimeException("Test Failed");
}
createUI();
robot.waitForIdle();
executetest();
if (!"".equals(errorMessage)) {
throw new RuntimeException(errorMessage);
}
}
项目:openjdk-jdk10
文件:Test7022041.java
public static void main(String[] args) throws Exception {
UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
// try to test all installed Look and Feels
for (UIManager.LookAndFeelInfo lookAndFeel : installedLookAndFeels) {
String name = lookAndFeel.getName();
System.out.println("Testing " + name);
// Some Look and Feels work only when test is run in a GUI environment
// (GTK+ LAF is an example)
try {
UIManager.setLookAndFeel(lookAndFeel.getClassName());
checkTitleColor();
System.out.println(" titleColor test ok");
checkTitleFont();
System.out.println(" titleFont test ok");
}
catch (UnsupportedLookAndFeelException e) {
System.out.println(" Note: LookAndFeel " + name
+ " is not supported on this configuration");
}
}
}
项目:openjdk-jdk10
文件:JInternalFrameIconTest.java
private static boolean tryLookAndFeel(String lookAndFeelString)
throws Exception {
//This test case is not applicable for Motif and gtk LAFs
if(lookAndFeelString.contains("motif")
|| lookAndFeelString.contains("gtk")) {
return false;
}
try {
UIManager.setLookAndFeel(
lookAndFeelString);
} catch (UnsupportedLookAndFeelException
| ClassNotFoundException
| InstantiationException
| illegalaccessexception e) {
return false;
}
return true;
}
private static boolean tryLookAndFeel(String lookAndFeelString)
throws Exception {
try {
UIManager.setLookAndFeel(
lookAndFeelString);
} catch (UnsupportedLookAndFeelException
| ClassNotFoundException
| InstantiationException
| illegalaccessexception e) {
errorString += e.getMessage() + "\n";
System.err.println("[Exception]: " + e.getMessage());
return false;
}
return true;
}
项目:Pixie
文件:GUILabelingTool.java
/**
* The entry point of application.
*
* @param args the command line arguments
*/
public static void main(String[] args) {
Logger logger = LoggerFactory.getLogger(GUILabelingTool.class);
System.getProperty("java.library.path");
/* Create and display the form */
java.awt.EventQueue.invokelater(() -> {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// SplashScreen.startSplash()
GUILabelingTool gui = new GUILabelingTool(logger);
gui.setVisible(true);
// for the first run,some special configuration have to be done
gui.firstStartinitialization();
} catch (ClassNotFoundException | InstantiationException | illegalaccessexception | UnsupportedLookAndFeelException ex) {
logger.error("Create and display form");
logger.debug("Create and display form {}",ex);
}
});
}
项目:VisualGraphviz
文件:MainFrame.java
private void init(int w,int h) {
this.setBounds((Toolkit.getDefaultToolkit().getScreenSize().width - w) / 2,(Toolkit.getDefaultToolkit().getScreenSize().height - h) / 2,w,h);
this.setTitle("Visual Graphviz v1.04");
this.setFont(buttonFont);
this.setLayout(null);
/* set close operation */
this.setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);
/* set window style */
try {
/* UIManager.setLookAndFeel(WINDOWS_STYLE); */
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | illegalaccessexception
| UnsupportedLookAndFeelException e) {
e.printstacktrace();
}
/* this.setResizable(false); */
container = this.getContentPane();
container.setLayout(null);
}
项目:visuflow-plugin
文件:CFGView.java
private void createGraphComposite(Composite parent) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | illegalaccessexception
| UnsupportedLookAndFeelException e) {
e.printstacktrace();
}
Composite composite = new Composite(parent,SWT.EMbedDED | SWT.NO_BACKGROUND);
ClassLoader loader = CFGView.class.getClassLoader();
URL stylesheetUrl = loader.getResource("/styles/styleSheet.css");
System.setProperty("sun.awt.noerasebackground","true");
System.setProperty("org.graphstream.ui.renderer","org.graphstream.ui.j2dviewer.J2DGraphRenderer");
GraphManager manager = new GraphManager("VisuFlow Graph","url('"+stylesheetUrl.toString()+"')");
Thread t = new Thread(manager);
t.start();
Frame frame = SWT_AWT.new_Frame(composite);
frame.add(manager.getApplet());
frame.pack();
}
项目:pm-home-station
文件:Start.java
private static void setLookAndFeel() {
if (SystemUtils.IS_OS_MAC_OSX) {
// must be before any AWT interaction
System.setProperty("apple.laf.useScreenMenuBar","true"); // place menubar (if any) in native menu bar
System.setProperty("apple.awt.application.name",Constants.PROJECT_NAME);
if (Config.instance().to().getBoolean(Config.Entry.SYstem_TRAY.key(),Constants.SYstem_TRAY)) {
logger.debug("Hiding dock icon since system-tray integration is enabled");
System.setProperty("apple.awt.UIElement","true");
}
}
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | illegalaccessexception
| UnsupportedLookAndFeelException e) {
logger.error("Ooops,problem setting system L&F",e);
}
}
public static void main(String[] args) {
UIManager.put("swing.boldMetal","true");
try {
UIManager.setLookAndFeel(new MetalLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
System.out.println(
"Metal Look & Feel not supported on this platform. \n"
+ "Program Terminated");
System.exit(0);
}
JFrame frame = new MetalworksFrame();
frame.setVisible(true);
}
项目:openjdk9
文件:MaximizedFrameTest.java
public void init() {
JFrame.setDefaultLookAndFeelDecorated(true);
try {
UIManager.setLookAndFeel("javax.swing.plaf.Metal.MetalLookAndFeel");
} catch (ClassNotFoundException | InstantiationException |
illegalaccessexception | UnsupportedLookAndFeelException ex) {
throw new RuntimeException("Test Failed. MetalLookAndFeel not set "
+ "for frame");
}
frame = new JFrame("JFrame maximization Test");
frame.pack();
frame.setSize(450,260);
frame.setVisible(true);
}
项目:openjdk9
文件:bug8046391.java
public static void main(String[] args) throws Exception {
OSType type = OSInfo.getoSType();
if (type != OSType.WINDOWS) {
System.out.println("This test is for Windows only... skipping!");
return;
}
SwingUtilities.invokeAndWait(() -> {
try {
UIManager.setLookAndFeel(new WindowsLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
e.printstacktrace();
}
System.out.println("Creating JFileChooser...");
JFileChooser fileChooser = new JFileChooser();
System.out.println("Test passed: chooser = " + fileChooser);
});
// Test fails if creating JFileChooser hangs
}
项目:openjdk9
文件:Test7022041.java
public static void main(String[] args) throws Exception {
UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
// try to test all installed Look and Feels
for (UIManager.LookAndFeelInfo lookAndFeel : installedLookAndFeels) {
String name = lookAndFeel.getName();
System.out.println("Testing " + name);
// Some Look and Feels work only when test is run in a GUI environment
// (GTK+ LAF is an example)
try {
UIManager.setLookAndFeel(lookAndFeel.getClassName());
checkTitleColor();
System.out.println(" titleColor test ok");
checkTitleFont();
System.out.println(" titleFont test ok");
}
catch (UnsupportedLookAndFeelException e) {
System.out.println(" Note: LookAndFeel " + name
+ " is not supported on this configuration");
}
}
}
项目:openjdk9
文件:JInternalFrameIconTest.java
private static boolean tryLookAndFeel(String lookAndFeelString)
throws Exception {
//This test case is not applicable for Motif and gtk LAFs
if(lookAndFeelString.contains("motif")
|| lookAndFeelString.contains("gtk")) {
return false;
}
try {
UIManager.setLookAndFeel(
lookAndFeelString);
} catch (UnsupportedLookAndFeelException
| ClassNotFoundException
| InstantiationException
| illegalaccessexception e) {
return false;
}
return true;
}
private static boolean tryLookAndFeel(String lookAndFeelString)
throws Exception {
try {
UIManager.setLookAndFeel(
lookAndFeelString);
} catch (UnsupportedLookAndFeelException
| ClassNotFoundException
| InstantiationException
| illegalaccessexception e) {
errorString += e.getMessage() + "\n";
System.err.println("[Exception]: " + e.getMessage());
return false;
}
return true;
}
项目:VenusScript
文件:SetTheme.java
@Override
public Value call(Context context,FunctionCallDescriptor descriptor) throws ScriptRuntimeException {
StringValue value = (StringValue) descriptor.get(0);
String themeName = value.value();
String themePath = null;
if (themeName.equalsIgnoreCase("Metal")) {
themePath = UIManager.getCrossplatformlookAndFeelClassName();
}
else if (themeName.equalsIgnoreCase("system")) {
themePath = UIManager.getSystemLookAndFeelClassName();
}
if (themePath != null) {
try {
UIManager.setLookAndFeel(themePath);
return new BoolValue(true);
}
catch (ClassNotFoundException | illegalaccessexception | InstantiationException | UnsupportedLookAndFeelException exception) {
}
}
return new BoolValue(false);
}
项目:java-maze-algorithms
文件:Maze.java
public Maze() {
cols = Math.floorDiv(WIDTH,W);
rows = cols;
EventQueue.invokelater(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | illegalaccessexception
| UnsupportedLookAndFeelException ex) {
ex.printstacktrace();
}
createAndShowGUI();
}
});
}
项目:Moose
文件:Moose.java
public static void main(String[] args) throws AWTException,ClassNotFoundException,UnsupportedLookAndFeelException
{
// Set OS look and feel
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Moose moose = Moose.getInstance();
// Check for newer version and show notification popup if anything is found
moose.checkForUpdatesAndNotifyIfAnyFound();
try
{
SimpleHttpServer.start();
}
catch (Exception e)
{
// Can happen if the port is already in use
logger.fatal("Could not start web server: " + e.getMessage(),e);
System.exit(1);
}
logger.info("Started Moose");
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。