本文整理汇总了Java中javax.swing.UIManager类的典型用法代码示例。如果您正苦于以下问题:Java UIManager类的具体用法?Java UIManager怎么用?Java UIManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIManager类属于javax.swing包,在下文中一共展示了UIManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Installer
import javax.swing.UIManager; //导入依赖的package包/类
public Installer(JsonObject json) {
this.versions = json.entrySet();
System.out.println(versions.toString());
String low = "", high = "";
for (Map.Entry<String, JsonElement> entry : versions) {
if (high.isEmpty()) {
high = entry.getKey();
} else {
low = entry.getKey();
}
}
v = (low.isEmpty() ? high : low + "-" + high);
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
this.setTitle(Main.name + " Installer");
this.initGui();
}
示例2: BaseUtility
import javax.swing.UIManager; //导入依赖的package包/类
@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();
}
示例3: setLookAndFeel
import javax.swing.UIManager; //导入依赖的package包/类
/**
* Sets the look and feel of the dialog similar to the current application window
*/
private void setLookAndFeel() {
// --- Some exit options --------------------------
if (this.lookAndFeelClassName==null) return;
String currLookAndFeelClassName = UIManager.getLookAndFeel().getClass().getName();
if (this.lookAndFeelClassName.equals(currLookAndFeelClassName)==true) return;
// --- Try to set the look and feel ---------------
try {
UIManager.setLookAndFeel(this.lookAndFeelClassName);
SwingUtilities.updateComponentTreeUI(this.getProgressMonitorContainer());
} catch (Exception ex) {
System.err.println("Cannot install " + this.lookAndFeelClassName + " on this platform:" + ex.getMessage());
}
}
示例4: updateUI
import javax.swing.UIManager; //导入依赖的package包/类
/**
* updateUI is overridden to set the colors of the Tree's renderer to
* match that of the table.
*/
public void updateUI() {
super.updateUI();
// Make the tree's cell renderer use the table's cell selection
// colors.
TreeCellRenderer tcr = getCellRenderer();
if (tcr instanceof DefaultTreeCellRenderer) {
DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer) tcr);
dtcr.setBorderSelectionColor(null);
dtcr.setTextSelectionColor(UIManager
.getColor("Table.selectionForeground"));
dtcr.setBackgroundSelectionColor(UIManager
.getColor("Table.selectionBackground"));
}
}
示例5: actionPerformed
import javax.swing.UIManager; //导入依赖的package包/类
/** The operation to perform when this action is triggered. */
public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {
try {
int offs = target.getCaretPosition();
int begOffs = Utilities.getWordStart(target, offs);
if (select) {
target.moveCaretPosition(begOffs);
} else {
target.setCaretPosition(begOffs);
}
} catch (BadLocationException bl) {
UIManager.getLookAndFeel().provideErrorFeedback(target);
}
}
}
示例6: show
import javax.swing.UIManager; //导入依赖的package包/类
private void show(Window window) {
JButton jButton = new JButton("Show ColorChooser");
jButton.setActionCommand("Show ColorChooser");
jButton.addActionListener(this);
this.cbPlaf = new JComboBox<UIManager.LookAndFeelInfo>(UIManager.getInstalledLookAndFeels());
this.cbPlaf.addItemListener(new ItemListener(){
@Override
public void itemStateChanged(ItemEvent itemEvent) {
if (itemEvent.getStateChange() == 1) {
SwingUtilities.invokeLater(new Runnable(){
@Override
public void run() {
UIManager.LookAndFeelInfo lookAndFeelInfo = (UIManager.LookAndFeelInfo)Test4319113.this.cbPlaf.getSelectedItem();
try {
UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
Frame[] arrframe = Frame.getFrames();
int n = arrframe.length;
while (--n >= 0) {
Test4319113.updateWindowTreeUI(arrframe[n]);
}
}
catch (Exception var2_3) {
System.err.println("Exception while changing L&F!");
}
}
});
}
}
});
window.add(this.cbPlaf);
window.add(jButton);
window.pack();
window.setVisible(true);
}
示例7: main
import javax.swing.UIManager; //导入依赖的package包/类
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);
}
}
示例8: getTreeBackgroundColor
import javax.swing.UIManager; //导入依赖的package包/类
private static Color getTreeBackgroundColor() {
Color c = null;
if ("Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
c = UIManager.getColor("NbExplorerView.background"); //NOI18N
}
if (c == null) {
c = UIManager.getColor("Tree.textBackground"); // NOI18N
}
return c;
}
示例9: main
import javax.swing.UIManager; //导入依赖的package包/类
/**
* Einstiegspunkt für das Tool.
*
* @param args wird nicht beachtet
* @throws Exception unterschiedliche Ursachen
*/
public static void main(String[] args) throws Exception {
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
}
catch (Exception e) {
e.printStackTrace();
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new ToolsLauncher();
}
});
}
示例10: getJxdatetimepickerMonthStringBackground
import javax.swing.UIManager; //导入依赖的package包/类
public static Color getJxdatetimepickerMonthStringBackground() {
Color managerColor = UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringBackground");
if (managerColor == null) {
UIManager.put("nb.dataview.jxdatetimepicker.monthStringBackground", UIManager.getColor("JXMonthView.monthStringBackground")); //NOI18N
return UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringBackground"); //NOI18N
} else {
return managerColor;
}
}
示例11: paintTabBackground
import javax.swing.UIManager; //导入依赖的package包/类
@Override
protected void paintTabBackground(Graphics g, int index, int x, int y,
int width, int height) {
Graphics2D g2d = (Graphics2D) g;
Paint p = g2d.getPaint();
if( isSelected(index) ) {
g2d.setPaint( ColorUtil.getGradientPaint(x, y, UIManager.getColor("NbTabControl.selectedTabBrighterBackground"),
x, y+height/2, UIManager.getColor("NbTabControl.selectedTabDarkerBackground")) );
} else if( isMouseOver(index) ) {
g2d.setPaint( ColorUtil.getGradientPaint(x, y, UIManager.getColor("NbTabControl.mouseoverTabBrighterBackground"),
x, y+height/2, UIManager.getColor("NbTabControl.mouseoverTabDarkerBackground")) );
} else {
g2d.setPaint( ColorUtil.getGradientPaint(x, y, UIManager.getColor("NbTabControl.inactiveTabBrighterBackground"),
x, y+height/2, UIManager.getColor("NbTabControl.inactiveTabDarkerBackground")) );
}
g2d.fillRect(x, y, width, height);
g2d.setPaint(p);
}
示例12: RegisterGUI
import javax.swing.UIManager; //导入依赖的package包/类
/** 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, null, exception);
}
initComponents();
Utils.setWindowCenterOfScreen(this);
setVisible(true);
}
示例13: main
import javax.swing.UIManager; //导入依赖的package包/类
public static void main(String[] args) throws Throwable {
//Execute test for all supported look and feels
UIManager.LookAndFeelInfo[] lookAndFeelArray
= UIManager.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
String lookAndFeelString = lookAndFeelItem.getClassName();
UIManager.setLookAndFeel(lookAndFeelString);
// Test getTableCellRendererComponent method by passing null table
JTableHeader header = new JTableHeader();
header.getDefaultRenderer().getTableCellRendererComponent(null,
" test ", true, true, -1, 0);
}
}
示例14: initGui
import javax.swing.UIManager; //导入依赖的package包/类
protected TreeView initGui () {
TTW retVal = new TTW () ;
split = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT);
PropertySheetView propertyView = new PropertySheetView();
split.setLeftComponent(retVal);
split.setRightComponent(propertyView);
// install proper border for split pane
split.setBorder((Border)UIManager.get("Nb.ScrollPane.border")); // NOI18N
setLayout (new java.awt.GridBagLayout ());
GridBagConstraints gridBagConstraints = new GridBagConstraints ();
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.gridwidth = 2;
add (split, gridBagConstraints);
return retVal;
}
示例15: createDetails
import javax.swing.UIManager; //导入依赖的package包/类
private JComponent createDetails( String text, ActionListener action ) {
if( null == action ) {
return new JLabel(text);
}
try {
text = "<html><u>" + XMLUtil.toElementContent(text); //NOI18N
} catch( CharConversionException ex ) {
throw new IllegalArgumentException(ex);
}
JButton btn = new JButton(text);
btn.setFocusable(false);
btn.setBorder(BorderFactory.createEmptyBorder());
btn.setBorderPainted(false);
btn.setFocusPainted(false);
btn.setOpaque(false);
btn.setContentAreaFilled(false);
btn.addActionListener(action);
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
if (c != null) {
btn.setForeground(c);
}
return btn;
}