javax.swing.UIManager.setLookAndFeel()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(294)

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

UIManager.setLookAndFeel介绍

暂无

代码示例

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

JFrame f = new JFrame("Frame " + ii);
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
String s =
  "os.name: " + System.getProperty("os.name") +
  "\nos.version: " + System.getProperty("os.version");
f.add(new JTextArea(s,3,28));  // suggest a size
f.pack();
f.setVisible(true);
public void run() {
  try {
    UIManager.setLookAndFeel(
      UIManager.getSystemLookAndFeelClassName());
  } catch (Exception useDefault) {}
  initGui();

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
  logger.warning("Could not set native look and feel.");
this.getContentPane().add(mainPanel);

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

s.getViewport().add(m_tree);
getContentPane().add(s, BorderLayout.CENTER);
setVisible(true);
  UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception evt) {}
new FileTreeViewer();

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

public static void main(String[] args) {
  try {
    UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");
  } catch (Exception ex) {
    ex.printStackTrace();
  }
  JFrame f = new JFrame("Drawing Settings2");
  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  f.add(new EditCanvasPanel());
  f.pack();
  f.setVisible(true);
}

代码示例来源:origin: UISpec4J/UISpec4J

public static void show(Window window) throws Exception {
 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
 window.pack();
 window.setVisible(true);
}

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

final JFrame frame = new JFrame("Nested Layout Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
plafComponents.add(plafChooser);
plafComponents.add(pack);
    int index = plafChooser.getSelectedIndex();
    try {
      UIManager.setLookAndFeel(
        plafInfos[index].getClassName() );
      SwingUtilities.updateComponentTreeUI(frame);
      if (pack.isSelected()) {
        frame.pack();
        frame.setMinimumSize(frame.getSize());
gui.add(plafComponents, BorderLayout.NORTH);
frame.pack();
frame.setVisible(true);

代码示例来源:origin: RipMeApp/ripme

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | UnsupportedLookAndFeelException | IllegalAccessException e) {
  LOGGER.error("[!] Exception setting system theme:", e);
gbc.gridy = 0; pane.add(ripPanel, gbc);
gbc.gridy = 1; pane.add(statusPanel, gbc);
gbc.gridy = 2; pane.add(progressPanel, gbc);
gbc.gridy = 3; pane.add(optionsPanel, gbc);
gbc.weighty = 1;

代码示例来源:origin: UISpec4J/UISpec4J

public static void show(Window window) throws Exception {
 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
 window.pack();
 window.setVisible(true);
}

代码示例来源:origin: SonarSource/sonarqube

for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
  if ("Nimbus".equals(info.getName())) {
   UIManager.setLookAndFeel(info.getClassName());
   break;
frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(splitPane, BorderLayout.CENTER);

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

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
frame.getContentPane().add(mainPanel, BorderLayout.CENTER);
frame.pack();

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

public void run() {
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
  JFrame frame = new JFrame("Testing");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setLayout(new BorderLayout());
  frame.add(new TestPane());
  frame.pack();
  frame.setLocationRelativeTo(null);
  frame.setVisible(true);

代码示例来源:origin: opensourceBIM/BIMserver

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
  e.printStackTrace();
getContentPane().add(fields, BorderLayout.NORTH);
getContentPane().add(scrollPane, BorderLayout.CENTER);
getContentPane().add(buttons, BorderLayout.SOUTH);

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

public void run() {
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
  JFrame window = new JFrame();
  window.setSize(840, 560);
  window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  window.add(grid);
  window.setVisible(true);
  grid.fillCell(0, 0);
  grid.fillCell(79, 0);

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

public void run() {
 try {
  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
 } catch (final Exception e1) {
  e1.printStackTrace();
 l.setOpaque(false);
 c.add(l, constraints);
 b.setFocusable(false);
 c.add(b, constraints);

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

public void run() {
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
  JFrame frame = new JFrame("Testing");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setLayout(new BorderLayout());
  frame.add(new TestPane());
  frame.pack();
  frame.setLocationRelativeTo(null);
  frame.setVisible(true);
    add(cellPane, gbc);

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

try{
  System.out.println("setting look and feel");
  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}catch(Exception e){
  System.out.println("Unable to set LookAndFeel");
  defaultItem.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      setVisible(true);
      setExtendedState(JFrame.NORMAL);
      try {
        tray.add(trayIcon);
        setVisible(false);
        System.out.println("added to SystemTray");
      } catch (AWTException ex) {
      try{
  tray.add(trayIcon);
  setVisible(false);
  System.out.println("added to SystemTray");
  }catch(AWTException ex){
setVisible(true);
setSize(300, 200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

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

final JFrame frame = new JFrame("Demo buttons");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
buttonPanel.add(new JButton("Export do SVG"));
buttonPanel.add(new JButton("Export do PNG"));
buttonPanel.add(new JButton("Tisk..."));
frame.add(center);
frame.pack();
frame.setVisible(true);
  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
  e.printStackTrace();

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

public void run() {
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
    JFrame frame = new JFrame("Testing");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    frame.add(new JLabel("Hello world"), gbc);
    frame.add(new JLabel("I'm on top"), gbc);
    frame.add(new JButton("Clickity-clackity"), gbc);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  } catch (IOException exp) {
    exp.printStackTrace();

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

public void run() {
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
  JFrame frame = new JFrame("Testing");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setLayout(new BorderLayout());
  frame.add(new TestPane());
  frame.pack();
  frame.setLocationRelativeTo(null);
  frame.setVisible(true);

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

public void run() {
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
    label.setFont(font);
    JFrame frame = new JFrame("Testing");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLayout(new GridBagLayout());
    frame.add(label);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  } catch (IOException | FontFormatException exp) {
    exp.printStackTrace();

相关文章