本文整理汇总了Java中org.jvnet.substance.SubstanceLookAndFeel类的典型用法代码示例。如果您正苦于以下问题:Java SubstanceLookAndFeel类的具体用法?Java SubstanceLookAndFeel怎么用?Java SubstanceLookAndFeel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SubstanceLookAndFeel类属于org.jvnet.substance包,在下文中一共展示了SubstanceLookAndFeel类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
public static void main(String[] args) {
try {
// 设置观感
UIManager
.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel");
// 设置水印
SubstanceLookAndFeel
.setCurrentWatermark("org.jvnet.substance.watermark.SubstanceMosaicWatermark");
// 设置渐变渲染
SubstanceLookAndFeel
.setCurrentGradientPainter("org.jvnet.substance.painter.WaveGradientPainter");
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
EventQueue.invokeLater(() -> {
new HubFrame();
});
}
示例2: main
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
public static void main(String args[]) {
try {
UIManager.setLookAndFeel(new SubstanceLookAndFeel());
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());
SubstanceLookAndFeel.setSkin(new OfficeBlue2007Skin());
SubstanceLookAndFeel.setCurrentButtonShaper(new ClassicButtonShaper());
SubstanceLookAndFeel.setCurrentWatermark(new SubstanceBubblesWatermark());
SubstanceLookAndFeel.setCurrentBorderPainter(new StandardBorderPainter());
SubstanceLookAndFeel.setCurrentGradientPainter(new StandardGradientPainter());
//SubstanceLookAndFeel.setCurrentTitlePainter(new FlatTitePainter());
} catch (Exception e) {
System.err.println("Something went wrong!");
}
SeverUI server = new SeverUI();
server.setVisible(true);
server.start();
}
示例3: initialize
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
public void initialize() throws Exception {
String skin = ObjectUtils.toString(config.get("UISkin")).trim();
String theme = ObjectUtils.toString(config.get("UITheme")).trim();
if(skin.equalsIgnoreCase("default")) //java default
return;
UIManager.setLookAndFeel(new SubstanceLookAndFeel());
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
if(StringUtils.isNotEmpty(theme))
SubstanceLookAndFeel.setCurrentTheme(theme);
else if(StringUtils.isNotEmpty(skin))
SubstanceLookAndFeel.setSkin((SubstanceSkin)newInstance(skin));
String watermark = ObjectUtils.toString(config.get("UIWatermark")).trim();
if(StringUtils.isNotEmpty(watermark))
SubstanceLookAndFeel.setCurrentWatermark((SubstanceWatermark)newInstance(watermark));
String buttonShaper = ObjectUtils.toString(config.get("UIButtonShaper")).trim();
if(StringUtils.isNotEmpty(buttonShaper))
SubstanceLookAndFeel.setCurrentButtonShaper((SubstanceButtonShaper)newInstance(buttonShaper));
String borderPainter = ObjectUtils.toString(config.get("UIBorderPainter")).trim();
if(StringUtils.isNotEmpty(borderPainter))
SubstanceLookAndFeel.setCurrentBorderPainter((SubstanceBorderPainter)newInstance(borderPainter));
String gradientPainter = ObjectUtils.toString(config.get("UIGradientPainter")).trim();
if(StringUtils.isNotEmpty(gradientPainter))
SubstanceLookAndFeel.setCurrentGradientPainter((SubstanceGradientPainter)newInstance(gradientPainter));
}
示例4: saveCurrent
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
public void saveCurrent() {
try {
SkinInfo currentSkin = SubstanceLookAndFeel.getAllSkins().get(SubstanceLookAndFeel.getCurrentThemeName());
ThemeInfo currentTheme = SubstanceLookAndFeel.getAllThemes().get(SubstanceLookAndFeel.getCurrentThemeName());
config.set("UISkin", currentSkin != null ? currentSkin.getClassName() : "");
config.set("UITheme", currentTheme != null ? currentTheme.getClassName() : "");
config.set("UIWatermark", SubstanceLookAndFeel.getCurrentWatermark().getClass().getName());
config.set("UIButtonShaper", SubstanceLookAndFeel.getCurrentButtonShaper().getClass().getName());
config.set("UIBorderPainter", SubstanceLookAndFeel.getCurrentBorderPainter().getClass().getName());
config.set("UIGradientPainter", SubstanceLookAndFeel.getCurrentGradientPainter().getClass().getName());
config.save();
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: setLookAndFeel
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
public static void setLookAndFeel(String theme) {
try {
// Use Business as base Look And Feel
UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessLookAndFeel");
if (themes.containsKey(theme))
SubstanceLookAndFeel.setCurrentTheme(themes.get(theme));
else
SubstanceLookAndFeel.setCurrentTheme(themes.get(DEFAULT_THEME));
SubstanceLookAndFeel.setCurrentWatermark(new SubstanceStripeWatermark());
UIManager.put(SubstanceLookAndFeel.NO_EXTRA_ELEMENTS,Boolean.TRUE);
JFrame.setDefaultLookAndFeelDecorated(!Kernel.getInstance().state.isMultipleWindow());
} catch (Exception e) {
}
}
示例6: main
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
public static void main(String[] args){
try {
UIManager.setLookAndFeel(new SubstanceLookAndFeel());
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());
SubstanceLookAndFeel.setSkin(new OfficeBlue2007Skin());
SubstanceLookAndFeel.setCurrentButtonShaper(new ClassicButtonShaper());
SubstanceLookAndFeel.setCurrentWatermark(new SubstanceBubblesWatermark());
SubstanceLookAndFeel.setCurrentBorderPainter(new StandardBorderPainter());
SubstanceLookAndFeel.setCurrentGradientPainter(new StandardGradientPainter());
//SubstanceLookAndFeel.setCurrentTitlePainter(new FlatTitePainter());
} catch (Exception e) {
System.err.println("Something went wrong!");
}
UI frame=new UI();
frame.setTitle("DictPro");
frame.setSize(600,500);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
示例7: startup
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
public void startup() {
MainWindowIconManager.apply(this);
JDialog.setDefaultLookAndFeelDecorated(true);
UIManager.put(SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND, TabContentPaneBorderKind.SINGLE_FULL);
setTitle(TITLE_WORKCRAFT);
// Create main menu.
mainMenu = new MainMenu(this);
MenuBarUI menuUI = mainMenu.getUI();
setJMenuBar(mainMenu);
// Tweak look-and-feel.
SilverOceanTheme.enable();
LookAndFeelHelper.setDefaultLookAndFeel();
SwingUtilities.updateComponentTreeUI(this);
if (DesktopApi.getOs().isMac()) {
// Menu UI needs to be restored for OSX (global menu Look-and-Feel).
mainMenu.setUI(menuUI);
}
// Create content panel and docking ports.
layout = new MultiBorderLayout();
content = new JPanel(layout);
setContentPane(content);
rootDockingPort = new DefaultDockingPort(FLEXDOCK_DOCKING_PORT);
content.add(rootDockingPort, BorderLayout.CENTER);
StandardBorderManager borderManager = new StandardBorderManager(new ShadowBorder());
rootDockingPort.setBorderManager(borderManager);
// Create toolbars.
globalToolbar = new ToolBar(this);
modelToolbar = new JToolBar("Model tools");
controlToolbar = new JToolBar("Tool controls");
mainMenu.registerToolbar(globalToolbar);
mainMenu.registerToolbar(modelToolbar);
mainMenu.registerToolbar(controlToolbar);
loadToolbarParametersFromConfig();
// Create dockable windows.
createWindows();
createDockingLayout();
loadWindowGeometryFromConfig();
loadRecentFilesFromConfig();
// Display window in its default state.
setVisible(true);
DockableWindow.updateHeaders(rootDockingPort, getDefaultActionListener());
DockingManager.display(outputDockable);
utilityWindows.add(documentPlaceholder);
new Thread(new Runnable() {
@Override
public void run() {
// Hack to fix the annoying delay occurring when
// createGlyphVector is called for the first time.
Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 1);
FontRenderContext frc = new FontRenderContext(new AffineTransform(), true, true);
font.createGlyphVector(frc, TITLE_PLACEHOLDER);
// Force SVG rendering classes to load.
GUI.createIconFromSVG("images/icon.svg");
}
}).start();
setWorkActionsEnableness(false);
}
示例8: setSubstance
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
public static void setSubstance(String laf) {
setLookAndFeel(laf);
UIManager.put(SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND, TabContentPaneBorderKind.SINGLE_FULL);
}
示例9: main
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
public static void main (final String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
if (!registerApp()) {
System.exit(1);
}
AppConfig config = new AppConfig(args);
config.load();
// set Locale.
String slang = config.getProperty("user.language");
String scountry = config.getProperty("user.country");
String svariant = config.getProperty("user.variant");
if (slang != null && !slang.equals("") && scountry != null && svariant != null) {
Locale.setDefault(new Locale(slang, scountry, svariant));
}
// Set the format patterns
Formats.setIntegerPattern(config.getProperty("format.integer"));
Formats.setDoublePattern(config.getProperty("format.double"));
Formats.setCurrencyPattern(config.getProperty("format.currency"));
Formats.setPercentPattern(config.getProperty("format.percent"));
Formats.setDatePattern(config.getProperty("format.date"));
Formats.setTimePattern(config.getProperty("format.time"));
Formats.setDateTimePattern(config.getProperty("format.datetime"));
// Set the look and feel.
try {
Object laf = Class.forName(config.getProperty("swing.defaultlaf")).newInstance();
if (laf instanceof LookAndFeel){
UIManager.setLookAndFeel((LookAndFeel) laf);
} else if (laf instanceof SubstanceSkin) {
SubstanceLookAndFeel.setSkin((SubstanceSkin) laf);
}
} catch (Exception e) {
logger.log(Level.WARNING, "Cannot set look and feel", e);
}
String screenmode = config.getProperty("machine.screenmode");
if ("fullscreen".equals(screenmode)) {
JRootKiosk rootkiosk = new JRootKiosk();
rootkiosk.initFrame(config);
} else {
JRootFrame rootframe = new JRootFrame();
rootframe.initFrame(config);
}
}
});
}
示例10: main
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
/**
*
* @param args
*/
public static void main (final String args[]) {
GraphicsEnvironment ge = GraphicsEnvironment
.getLocalGraphicsEnvironment();
Font[] allFonts = ge.getAllFonts();
for (Font font : allFonts) {
System.out.println(font.getFontName(Locale.US));
}
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
if (!registerApp()) {
System.exit(1);
}
AppConfig config = new AppConfig(args);
config.load();
// set Locale.
String slang = config.getProperty("user.language");
String scountry = config.getProperty("user.country");
String svariant = config.getProperty("user.variant");
if (slang != null && !slang.equals("") && scountry != null && svariant != null) {
Locale.setDefault(new Locale(slang, scountry, svariant));
}
// Set the format patterns
Formats.setIntegerPattern(config.getProperty("format.integer"));
Formats.setDoublePattern(config.getProperty("format.double"));
Formats.setCurrencyPattern(config.getProperty("format.currency"));
Formats.setPercentPattern(config.getProperty("format.percent"));
Formats.setDatePattern(config.getProperty("format.date"));
Formats.setTimePattern(config.getProperty("format.time"));
Formats.setDateTimePattern(config.getProperty("format.datetime"));
// Set the look and feel.
try {
Object laf = Class.forName(config.getProperty("swing.defaultlaf")).newInstance();
if (laf instanceof LookAndFeel){
UIManager.setLookAndFeel((LookAndFeel) laf);
} else if (laf instanceof SubstanceSkin) {
SubstanceLookAndFeel.setSkin((SubstanceSkin) laf);
}
// JG 6 May 2013 to multicatch
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
logger.log(Level.WARNING, "Cannot set Look and Feel", e);
}
// JG July 2014 Hostname for Tickets
String hostname = config.getProperty("machine.hostname");
TicketInfo.setHostname(hostname);
String screenmode = config.getProperty("machine.screenmode");
if ("fullscreen".equals(screenmode)) {
JRootKiosk rootkiosk = new JRootKiosk();
rootkiosk.initFrame(config);
} else {
JRootFrame rootframe = new JRootFrame();
rootframe.initFrame(config);
}
}
});
}
示例11: JPanelConfigGeneral
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
/** Creates new form JPanelConfigGeneral */
public JPanelConfigGeneral() {
initComponents();
jtxtMachineHostname.getDocument().addDocumentListener(dirty);
jcboLAF.addActionListener(dirty);
jcboMachineScreenmode.addActionListener(dirty);
jcboTicketsBag.addActionListener(dirty);
jchkHideInfo.addActionListener(dirty);
jtxtStartupText.getDocument().addDocumentListener(dirty);
jbtnLogoText.addActionListener(new DirectoryEvent(jtxtStartupText));
jtxtStartupLogo.getDocument().addDocumentListener(dirty);
jbtnLogoName.addActionListener(new DirectoryEvent(jtxtStartupLogo));
// Installed skins
LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();
for (LookAndFeelInfo laf : lafs) {
jcboLAF.addItem(new LAFInfo(laf.getName(), laf.getClassName()));
}
// Substance skins
// new SubstanceLookAndFeel()
Map<String, SkinInfo> skins = SubstanceLookAndFeel.getAllSkins();
for (SkinInfo skin : skins.values()) {
jcboLAF.addItem(new LAFInfo(skin.getDisplayName(), skin.getClassName()));
}
jcboLAF.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
changeLAF();
}
});
jcboMachineScreenmode.addItem("window");
jcboMachineScreenmode.addItem("fullscreen");
jcboTicketsBag.addItem("simple");
jcboTicketsBag.addItem("standard");
jcboTicketsBag.addItem("restaurant");
}
示例12: main
import org.jvnet.substance.SubstanceLookAndFeel; //导入依赖的package包/类
/**
*
* @param args
*/
public static void main (final String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
if (!registerApp()) {
System.exit(1);
}
AppConfig config = new AppConfig(args);
config.load();
// set Locale.
String slang = config.getProperty("user.language");
String scountry = config.getProperty("user.country");
String svariant = config.getProperty("user.variant");
if (slang != null && !slang.equals("") && scountry != null && svariant != null) {
Locale.setDefault(new Locale(slang, scountry, svariant));
}
// Set the format patterns
Formats.setIntegerPattern(config.getProperty("format.integer"));
Formats.setDoublePattern(config.getProperty("format.double"));
Formats.setCurrencyPattern(config.getProperty("format.currency"));
Formats.setPercentPattern(config.getProperty("format.percent"));
Formats.setDatePattern(config.getProperty("format.date"));
Formats.setTimePattern(config.getProperty("format.time"));
Formats.setDateTimePattern(config.getProperty("format.datetime"));
// Set the look and feel.
try {
Object laf = Class.forName(config.getProperty("swing.defaultlaf")).newInstance();
if (laf instanceof LookAndFeel){
UIManager.setLookAndFeel((LookAndFeel) laf);
} else if (laf instanceof SubstanceSkin) {
SubstanceLookAndFeel.setSkin((SubstanceSkin) laf);
}
// JG 6 May 2013 to multicatch
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
logger.log(Level.WARNING, "Cannot set Look and Feel", e);
}
// JG July 2014 Hostname for Tickets
String hostname = config.getProperty("machine.hostname");
TicketInfo.setHostname(hostname);
String screenmode = config.getProperty("machine.screenmode");
if ("fullscreen".equals(screenmode)) {
JRootKiosk rootkiosk = new JRootKiosk();
rootkiosk.initFrame(config);
} else {
JRootFrame rootframe = new JRootFrame();
rootframe.initFrame(config);
}
}
});
}