javax.swing.JDialog.setDefaultLookAndFeelDecorated()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(81)

本文整理了Java中javax.swing.JDialog.setDefaultLookAndFeelDecorated()方法的一些代码示例,展示了JDialog.setDefaultLookAndFeelDecorated()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.setDefaultLookAndFeelDecorated()方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:setDefaultLookAndFeelDecorated

JDialog.setDefaultLookAndFeelDecorated介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

import javax.swing.JDialog;
import javax.swing.JOptionPane;

public class DemoJOptionPane {
  public static void main(String[] args) {
    double value1 = 5, value2 = 3, result;

    JDialog.setDefaultLookAndFeelDecorated(true);
    String symbol = JOptionPane.showInputDialog(null, "+-*/",
        "Enter the symbol", JOptionPane.OK_OPTION);
    if (symbol.equals("+")) {
      result = value1 + value2;
      System.out.println("<h1>The sum is " + result + "</h1>");
    } else if (symbol.equals("-")) {
      result = value1 - value2;
      System.out.println("<h1>The sub is " + result + "</h1>");
    } else if (symbol.equals("*")) {
      result = value1 * value2;
      System.out.println("<h1>The multiplication is " + result + "</h1>");
    } else if (symbol.equals("/")) {
      result = value1 / value2;
      System.out.println("<h1>The division is " + result + "</h1>");
    }
  }
}

代码示例来源:origin: org.codeartisans.swing-on-steroids/sos-ui-swing

@Override
public void run()
{
  try {
    JFrame.setDefaultLookAndFeelDecorated( true );
    JDialog.setDefaultLookAndFeelDecorated( true );
    UIManager.setLookAndFeel( className );
  } catch ( Exception ex ) {
    throw new SwingFault( ex.getMessage(), ex );
  }
}

代码示例来源:origin: org.codeartisans.swing-on-steroids/sos-ui-swing

@Override
public void run()
{
  try {
    JFrame.setDefaultLookAndFeelDecorated( true );
    JDialog.setDefaultLookAndFeelDecorated( true );
    UIManager.setLookAndFeel( lookAndFeel );
  } catch ( Exception ex ) {
    throw new SwingFault( ex.getMessage(), ex );
  }
}

代码示例来源:origin: baishui2004/common_gui_tools

/**
   * 设置皮肤外观.
   */
  private boolean setLookAndFeel(String lookAndFeel) {
    try {
      UIManager.setLookAndFeel(lookAndFeel);
      JFrame.setDefaultLookAndFeelDecorated(true);
      JDialog.setDefaultLookAndFeelDecorated(true);
      return true;
    } catch (Exception e) {
      GuiUtils.log(e);
      return false;
    }
  }
});

代码示例来源:origin: SKCraft/SKMCLauncher

/**
 * Try to set the default look and feel.
 */
public static void setLookAndFeel() {
  try {
    UIManager.getLookAndFeelDefaults().put("ClassLoader",
        Launcher.class.getClassLoader());
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    System.setProperty("substancelaf.windowRoundedCorners", "false");
    UIManager.setLookAndFeel("com.sk89q.skmcl.skin.LauncherLookAndFeel");
  } catch (Exception e) {
    log.log(Level.WARNING, "Failed to set LAF", e);
  }
}

代码示例来源:origin: org.jspresso.framework/jspresso-swing-components

JDialog.setDefaultLookAndFeelDecorated(true);
UIManager.put(FORMATTED_TEXTFIELD_FONT_KEY,
  UIManager.get(TEXTFIELD_FONT_KEY));

代码示例来源:origin: cpesch/RouteConverter

public static void setLookAndFeel() {
  try {
    String lookAndFeelClass = preferences.get(LOOK_AND_FEEL_CLASS_PREFERENCE, "default");
    if ("default".equals(lookAndFeelClass))
      lookAndFeelClass = UIManager.getSystemLookAndFeelClassName();
    UIManager.setLookAndFeel(lookAndFeelClass);
  } catch (Exception e) {
    // intentionally do nothing
  }
  JFrame.setDefaultLookAndFeelDecorated(true);
  JDialog.setDefaultLookAndFeelDecorated(true);
  // to get menus out of the window and into the menu bar
  // https://developer.apple.com/library/content/documentation/Java/Conceptual/Java14Development/04-JavaUIToolkits/JavaUIToolkits.html
  if(isMac())
    System.setProperty("apple.laf.useScreenMenuBar", "true");
  // override what the JRE reads from the user's desktop settings as the user's desktop antialiased text preferences
  // https://docs.oracle.com/javase/7/docs/technotes/guides/2d/flags.html#aaFonts
  if (isLinux())
    System.setProperty("awt.useSystemAAFontSettings", "lcd");
  // enable the XRender-based Java 2D rendering pipeline for modern X11-based desktops, offering improved graphics performance
  // https://docs.oracle.com/javase/7/docs/technotes/guides/2d/flags.html#xrender
  if (isLinux())
    System.setProperty("sun.java2d.xrender", "true");
}

代码示例来源:origin: org.jspresso/jspresso-swing-components

JDialog.setDefaultLookAndFeelDecorated(true);
UIManager.put(FORMATTED_TEXTFIELD_FONT_KEY, UIManager
  .get(TEXTFIELD_FONT_KEY));

代码示例来源:origin: igniterealtime/Spark

private static void doSetLookAndFeel( String laf )
{
  try
  {
    if ( Spark.isWindows() )
    {
      JFrame.setDefaultLookAndFeelDecorated( true );
      JDialog.setDefaultLookAndFeelDecorated( true );
    }
    UIManager.setLookAndFeel( laf );
  }
  catch ( Exception e )
  {
    Log.error( "An exception occurred while trying to load the look and feel.", e );
  }
}

代码示例来源:origin: stackoverflow.com

System.setProperty("sun.awt.noerasebackground", "true");
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);

代码示例来源:origin: GoldenGnu/jeveassets

private static void createAndShowGUI() {
  initLookAndFeel();
  //Make sure we have nice window decorations.
  JFrame.setDefaultLookAndFeelDecorated(true);
  JDialog.setDefaultLookAndFeelDecorated(true);
  Main main = new Main();
}

代码示例来源:origin: Chatanga/Girinoscope

public static void main(String[] args) throws Exception {
  Set<String> flags = new HashSet<>(Arrays.asList(args));
  final boolean noLaf = flags.contains("-nolaf");
  Logger rootLogger = Logger.getLogger("org.hihan.girinoscope");
  rootLogger.setLevel(Level.WARNING);
  ConsoleHandler handler = new ConsoleHandler();
  handler.setFormatter(new SimpleFormatter());
  handler.setLevel(Level.ALL);
  rootLogger.addHandler(handler);
  JFrame.setDefaultLookAndFeelDecorated(true);
  JDialog.setDefaultLookAndFeelDecorated(true);
  SwingUtilities.invokeAndWait(new Runnable() {
    @Override
    public void run() {
      if (!noLaf) {
        SubstanceLookAndFeel.setSkin(new CeruleanSkin());
      }
      JFrame frame = new UI();
      frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
      frame.pack();
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);
    }
  });
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

JDialog.setDefaultLookAndFeelDecorated(true);

代码示例来源:origin: SKCraft/Launcher

@Override
  public void run() {
    try {
      Thread.currentThread().setContextClassLoader(FancyLauncher.class.getClassLoader());
      UIManager.getLookAndFeelDefaults().put("ClassLoader", FancyLauncher.class.getClassLoader());
      UIManager.getDefaults().put("SplitPane.border", BorderFactory.createEmptyBorder());
      JFrame.setDefaultLookAndFeelDecorated(true);
      JDialog.setDefaultLookAndFeelDecorated(true);
      System.setProperty("sun.awt.noerasebackground", "true");
      System.setProperty("substancelaf.windowRoundedCorners", "false");
      if (!SwingHelper.setLookAndFeel("com.skcraft.launcher.skin.LauncherLookAndFeel")) {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      }
      Launcher launcher = Launcher.createFromArguments(args);
      launcher.setMainWindowSupplier(new CustomWindowSupplier(launcher));
      launcher.showLauncherWindow();
    } catch (Throwable t) {
      log.log(Level.WARNING, "Load failure", t);
      SwingHelper.showErrorDialog(null, "Uh oh! The updater couldn't be opened because a " +
          "problem was encountered.", "Launcher error", t);
    }
  }
});

代码示例来源:origin: net.sf.squirrel-sql.plugins/laf

void applyPreferences()
{
  final LAFPreferences prefs = _plugin.getLAFPreferences();
  JFrame.setDefaultLookAndFeelDecorated(prefs.getCanLAFSetBorder());
  JDialog.setDefaultLookAndFeelDecorated(prefs.getCanLAFSetBorder());
}

代码示例来源:origin: bytedeco/procamtracker

JDialog.setDefaultLookAndFeelDecorated(true);

代码示例来源:origin: stackoverflow.com

JDialog.setDefaultLookAndFeelDecorated(true);
JDialog dialog = new JDialog();
dialog.setDefaultCloseOperation( JDialog.DISPOSE_ON_CLOSE );

代码示例来源:origin: stackoverflow.com

public void run() {
  JFrame.setDefaultLookAndFeelDecorated(true);
  JDialog.setDefaultLookAndFeelDecorated(true);
  try {
    UIManager.setLookAndFeel(new org.pushingpixels.substance.api.skin.SubstanceBusinessBlackSteelLookAndFeel());

代码示例来源:origin: net.sf.tinylaf/tinylaf

JDialog.setDefaultLookAndFeelDecorated(true);

代码示例来源:origin: kaikramer/keystore-explorer

private static void initLookAndFeel(ApplicationSettings applicationSettings) {
  LnfUtil.installLnfs();
  String lookFeelClassName = applicationSettings.getLookAndFeelClass();
  if (lookFeelClassName != null) {
    LnfUtil.useLnf(lookFeelClassName);
  } else {
    String lookAndFeelClass = LnfUtil.useLnfForPlatform();
    applicationSettings.setLookAndFeelClass(lookAndFeelClass);
  }
  boolean lookFeelDecorated = applicationSettings.getLookAndFeelDecorated();
  JFrame.setDefaultLookAndFeelDecorated(lookFeelDecorated);
  JDialog.setDefaultLookAndFeelDecorated(lookFeelDecorated);
}

相关文章

JDialog类方法