本文整理了Java中javax.swing.UIManager
类的一些代码示例,展示了UIManager
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UIManager
类的具体详情如下:
包路径:javax.swing.UIManager
类名称:UIManager
暂无
代码示例来源:origin: stackoverflow.com
EventQueue.invokeLater(new Runnable() {
@Override
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);
Point point = e.getPoint();
int width = getWidth();
int height = getHeight();
Graphics2D g2d = (Graphics2D) g.create();
int width = getWidth();
int height = getHeight();
代码示例来源:origin: log4j/log4j
public CategoryNodeRenderer() {
_panel.setBackground(UIManager.getColor("Tree.textBackground"));
if (_sat == null) {
// Load the satellite image.
String resource =
"/org/apache/log4j/lf5/viewer/images/channelexplorer_satellite.gif";
URL satURL = getClass().getResource(resource);
_sat = new ImageIcon(satURL);
}
setOpaque(false);
_checkBox.setOpaque(false);
_panel.setOpaque(false);
// The flowlayout set to LEFT is very important so that the editor
// doesn't jump around.
_panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
_panel.add(_checkBox);
_panel.add(this);
setOpenIcon(_sat);
setClosedIcon(_sat);
setLeafIcon(_sat);
}
代码示例来源:origin: alibaba/druid
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
JTableHeader header = table.getTableHeader();
if (header != null) {
setForeground(header.getForeground());
setBackground(header.getBackground());
setFont(header.getFont());
}
setHorizontalAlignment(JLabel.CENTER);
this.setText((value == null) ? "" : value.toString());
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
return this;
}
};
代码示例来源:origin: libgdx/libgdx
public static void main (String[] args) {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
try {
UIManager.setLookAndFeel(info.getClassName());
} catch (Throwable ignored) {
}
break;
}
}
EventQueue.invokeLater(new Runnable() {
public void run () {
new FlameMain();
}
});
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void actionPerformed(ActionEvent e){
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Throwable t){
t.printStackTrace();
}
SwingUtilities.updateComponentTreeUI(frame);
frame.pack();
}
});
代码示例来源: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.setLocationByPlatform(true);
f.setVisible(true);
public void run() {
try {
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
} catch (Exception useDefault) {}
initGui();
代码示例来源:origin: stackoverflow.com
EventQueue.invokeLater(new Runnable() {
@Override
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();
代码示例来源:origin: stackoverflow.com
EventQueue.invokeLater(new Runnable() {
@Override
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);
setLayout(new GridBagLayout());
cellPane.setBorder(border);
add(cellPane, gbc);
public void mouseEntered(MouseEvent e) {
defaultBackground = getBackground();
setBackground(Color.BLUE);
setBackground(defaultBackground);
代码示例来源:origin: igniterealtime/Openfire
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
frame.setTitle(appName);
frame.setIconImage(offIcon.getImage());
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
frame.getContentPane().add(mainPanel, BorderLayout.CENTER);
frame.pack();
代码示例来源:origin: stackoverflow.com
gui.setBorder( new TitledBorder("BorderLayout(5,5)") );
UIManager.getInstalledLookAndFeels();
String[] plafNames = new String[plafInfos.length];
for (int ii=0; ii<plafInfos.length; ii++) {
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);
gui.add( splitPane, BorderLayout.CENTER );
frame.setContentPane(gui);
frame.pack();
frame.setLocationRelativeTo(null);
代码示例来源: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: stackoverflow.com
super(4, 16);
this.alpha = alpha;
this.setBackground(new Color(0, 0, 0, alpha));
this.setFont(new Font("Serif", Font.ITALIC, 24));
this.setEditable(false);
JFrame f = new JFrame();
f.setLayout(new FlowLayout());
f.getContentPane().setBackground(new Color(0xffffc0));
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel.setBackground(new Color(0xffffc0));
panel.add(new TransparentTextArea(0));
jif.add(panel);
jif.setVisible(true);
f.add(jif);
f.pack();
f.setVisible(true);
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
EventQueue.invokeLater(new Runnable() {
代码示例来源:origin: stackoverflow.com
EventQueue.invokeLater(new Runnable() {
@Override
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
TableColumn tc = table.getColumnModel().getColumn(BOOLEAN_COL);
tc.setHeaderRenderer(new SelectAllHeader(table, BOOLEAN_COL));
JFrame f = new JFrame();
f.add(new JScrollPane(table));
f.pack();
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
this.setFont(UIManager.getFont("TableHeader.font"));
this.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
this.setBackground(UIManager.getColor("TableHeader.background"));
this.setForeground(UIManager.getColor("TableHeader.foreground"));
代码示例来源:origin: stackoverflow.com
getScreenInsets(dialog.getGraphicsConfiguration());
int taskBarSize = scnMax.bottom;
panel.setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = 0;
constraints.fill = GridBagConstraints.BOTH;
JLabel l = new JLabel("You have got 2 new Messages.");
panel.add(l, constraints);
constraints.gridx++;
constraints.weightx = 0f;
dialog.dispose();
setOpaque(true);
final Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(lpg);
g2d.fillRect(1, 1, getWidth() - 2, getHeight() - 2);
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
System.out.println(info.getName());
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
代码示例来源:origin: RipMeApp/ripme
checkChoise.add(yesButton);
checkChoise.add(noButton);
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Are you sure?");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(checkChoise);
frame.setSize(405, 70);
UIManager.put("FileChooser.useSystemExtensionHiding", false);
JFileChooser jfc = new JFileChooser(Utils.getWorkingDirectory());
jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
});
configUrlFileChooserButton.addActionListener(arg0 -> {
UIManager.put("FileChooser.useSystemExtensionHiding", false);
JFileChooser jfc = new JFileChooser(Utils.getWorkingDirectory());
jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
代码示例来源:origin: stackoverflow.com
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(500, 500);
setLayout(new BorderLayout());
setVisible(true);
panel = new JPanel();
panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_W, 0), "forward");
panel.getActionMap().put("forward", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
add(panel, BorderLayout.CENTER);
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
logger.warning("Could not set native look and feel.");
this.getContentPane().add(mainPanel);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Start the chooser.
*
* @param args
* command line parameters
*/
public static void main(final String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
}
new TestChooser().start(args);
}
代码示例来源:origin: camunda/camunda-bpm-platform
public CategoryNodeRenderer() {
_panel.setBackground(UIManager.getColor("Tree.textBackground"));
if (_sat == null) {
// Load the satellite image.
String resource =
"/org/apache/log4j/lf5/viewer/images/channelexplorer_satellite.gif";
URL satURL = getClass().getResource(resource);
_sat = new ImageIcon(satURL);
}
setOpaque(false);
_checkBox.setOpaque(false);
_panel.setOpaque(false);
// The flowlayout set to LEFT is very important so that the editor
// doesn't jump around.
_panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
_panel.add(_checkBox);
_panel.add(this);
setOpenIcon(_sat);
setClosedIcon(_sat);
setLeafIcon(_sat);
}
内容来源于网络,如有侵权,请联系作者删除!