📄 oyoahalookandfeel.java
字号:
else properties.load(getClass().getResourceAsStream("/com/oyoaha/swing/plaf/oyoaha/uidefaults.properties")); } catch(Exception e) { } try { //load from a text file Object[] uiDefaults = new Object[properties.size()*2]; Enumeration keys = properties.keys(); int count = 0; while (keys.hasMoreElements()) { uiDefaults[count++] = keys.nextElement(); uiDefaults[count] = properties.get(uiDefaults[count-1]); count++; } table.putDefaults(uiDefaults); ClassLoader cl = getClass().getClassLoader(); if(cl!=null) { table.put("ClassLoader",cl); } } catch(Exception e) { } } /** * */ protected void initComponentDefaults(UIDefaults table) { super.initComponentDefaults(table); //INITIALIZE BORDER Border buttonBorder = new OyoahaButtonBorder(0, 3); Border empty = new OyoahaEmptyBorder(2); Border empty2 = new OyoahaEmptyBorder(0); Border list = new OyoahaEmptyBorder(1); Border menu = new OyoahaMenuBorder(); Border menuBar = new OyoahaMenuBarBorder(); Border field = new OyoahaTextFieldBorder(); Border frame = new OyoahaInternalFrameBorder(0, 3); Border split = new OyoahaEmptyBorder(6); Border treelist = new OyoahaTreeListRendererBorder(); Border tableHeaderBorder = new OyoahaTableHeaderBorder(); //END INITIALIZE BORDER //INITIALIZE ICON Icon sliderIcon = new OyoahaSliderThumbIcon(); Icon radioButtonIcon = new OyoahaRadioButtonIcon(); Icon checkBoxIcon = new OyoahaCheckBoxIcon(); Object desktop = new LazyIconLoader("rc/file_desktop.gif"); Object drive = new LazyIconLoader("rc/file_hard.gif"); Object floppy = new LazyIconLoader("rc/file_floppy.gif"); Object treeOpenIcon = new LazyIconLoader("rc/tree_open.gif"); Object treeClosedIcon = new LazyIconLoader("rc/tree_close.gif"); Object treeLeaf = new LazyIconLoader("rc/tree_leaf.gif"); Object treeExpanded = new LazyIconLoader("rc/tree_expa.gif"); Object treeCollapsed = new LazyIconLoader("rc/tree_coll.gif"); Object newFolderIcon = new LazyIconLoader("rc/icon_new.gif"); Object upFolderIcon = new LazyIconLoader("rc/icon_up.gif"); Object sortIcon = new LazyIconLoader("rc/icon_sort.gif"); //Object InternalFrameIcon = new LazyIconLoader("rc/frame_sys.gif"); //Object InternalFrameMaximizeIcon = new LazyIconLoader("rc/frame_max.gif"); //Object InternalFrameIconifyIcon = new LazyIconLoader("rc/frame_ico.gif"); //Object InternalFrameMinimizeIcon = new LazyIconLoader("rc/frame_min.gif"); //Object InternalFrameCloseIcon = new LazyIconLoader("rc/frame_close.gif");OyoahaIconPool p = new OyoahaIconPool(this, new ImageIcon(getClass().getResource("rc/frame_sys.gif")).getImage(), null);OyoahaIcon InternalFrameIcon = new OyoahaIcon(p, null);p = new OyoahaIconPool(this, new ImageIcon(getClass().getResource("rc/frame_max.gif")).getImage(), null);OyoahaIcon InternalFrameMaximizeIcon = new OyoahaIcon(p, null); p = new OyoahaIconPool(this, new ImageIcon(getClass().getResource("rc/frame_ico.gif")).getImage(), null);OyoahaIcon InternalFrameIconifyIcon = new OyoahaIcon(p, null);p = new OyoahaIconPool(this, new ImageIcon(getClass().getResource("rc/frame_min.gif")).getImage(), null);OyoahaIcon InternalFrameMinimizeIcon = new OyoahaIcon(p, null);p = new OyoahaIconPool(this, new ImageIcon(getClass().getResource("rc/frame_close.gif")).getImage(), null);OyoahaIcon InternalFrameCloseIcon = new OyoahaIcon(p, null); Object errorIcon = new LazyIconLoader("rc/dial_error.gif"); Object informationIcon = new LazyIconLoader("rc/dial_inform.gif"); Object warningIcon = new LazyIconLoader("rc/dial_warn.gif"); Object questionIcon = new LazyIconLoader("rc/dial_question.gif"); //END INITIALIZE ICON //INITIALIZE OBJECT Object ListCellRender = new UIDefaults.ActiveValue() { public Object createValue(UIDefaults table) { return new OyoahaListCellRendererUI(); } }; //END INITIALIZE OBJECT //INITIALIZE BUMP OyoahaBumpPool bumpPool = new OyoahaBumpPool(this, new ImageIcon(getClass().getResource("rc/bump.gif")).getImage(), null); OyoahaBumpObject bump = new OyoahaBumpObject(bumpPool); //END INITIALIZE BUMP Object[] defaults = { "oyoaha3dBorder", new Boolean(true), // *** Bump "oyoahabump", bump, // *** OptionPane "OptionPane.errorIcon", errorIcon, "OptionPane.informationIcon", informationIcon, "OptionPane.warningIcon", warningIcon, "OptionPane.questionIcon", questionIcon, // *** FileView "FileView.directoryIcon", treeClosedIcon, "FileView.fileIcon", treeLeaf, "FileView.computerIcon", desktop, "FileView.hardDriveIcon", drive, "FileView.floppyDriveIcon", floppy, // *** FileChooser "FileChooser.newFolderIcon", newFolderIcon, "FileChooser.upFolderIcon", upFolderIcon, "FileChooser.sortIcon", sortIcon, // *** Tree "Tree.openIcon", treeOpenIcon, "Tree.closedIcon", treeClosedIcon, "Tree.leafIcon", treeLeaf, "Tree.expandedIcon", treeExpanded, "Tree.collapsedIcon", treeCollapsed, // *** Button "Button.border", buttonBorder,//"Button.realInsets", new InsetsUIResource(0,0,4,4), // *** ComboBox "ComboBox.border", buttonBorder,//"ComboBox.realInsets", new InsetsUIResource(0,0,4,4), // *** ToggleButton "ToggleButton.border", buttonBorder,//"ToggleButton.realInsets", new InsetsUIResource(0,0,4,4), // *** RadioButton "RadioButton.border", empty, "RadioButton.icon", radioButtonIcon, // *** CheckBox "CheckBox.border", empty, "CheckBox.icon", checkBoxIcon, // *** PopupMenu "PopupMenu.border", menu, // *** MenuBar "MenuBar.border", menuBar, // *** Menu "Menu.border", empty, // *** MenuItem "MenuItem.border", empty, // *** CheckBoxMenuItem, "CheckBoxMenuItem.checkIcon", checkBoxIcon, "CheckBoxMenuItem.border", empty, // *** RadioButtonMenuItem "RadioButtonMenuItem.checkIcon", radioButtonIcon, "RadioButtonMenuItem.border", empty, // *** TextField "TextField.border", field, "Spinner.border", empty, "PasswordField.border", field, "FormattedTextField.border", field, // *** ToolBar "ToolBar.border", new OyoahaToolBarBorder(), // *** Table //"TableHeader.foreground", table.get("controlText"), //"TableHeader.background", new Color(255,255,255,0), "TableHeader.cellBorder", tableHeaderBorder, // *** Slider "Slider.horizontalThumbIcon", sliderIcon, "Slider.verticalThumbIcon", sliderIcon, // *** List "List.border", list, "List.cellRenderer", ListCellRender, "List.drawsFocusBorderAroundIcon", new Boolean(true), "List.selectionBorder", treelist, // *** Tree "Tree.border", list, "Tree.selectionBorder", treelist, // *** TextArea "TextArea.border", empty2, // *** EditorPane "EditorPane.border", empty2, // *** EditorPane "TextPane.border", empty2, // *** ScrollPane "ScrollPane.border", new OyoahaTextFieldBorder(5,5,4,4), // *** Label "Label.foreground", getBlack(), // *** SplitPane "SplitPane.dividerSize", new Integer(7), "SplitPane.border", split, "SplitPaneDivider.border", list, // *** InternalFrame "InternalFrame.border", frame, "InternalFrame.optionDialogBorder", frame, "InternalFrame.paletteBorder", frame, "InternalFrame.background", getControl(),//"InternalFrame.realInsets", new InsetsUIResource(0,0,4,4), // Internal Frame Defaults "InternalFrame.paletteCloseIcon", InternalFrameCloseIcon, "InternalFrame.icon", InternalFrameIcon, "InternalFrame.closeIcon", InternalFrameCloseIcon, "InternalFrame.maximizeIcon", InternalFrameMaximizeIcon, "InternalFrame.iconifyIcon", InternalFrameIconifyIcon, "InternalFrame.minimizeIcon", InternalFrameMinimizeIcon, "InternalFrame.buttonBorder", buttonBorder, // *** Separator "Separator.foreground", getBlack(), "Separator.shadow", getBlack(), "Separator.highlight", getWhite(), "Separator.background", getWhite(), // *** TitledBorder "TitledBorder.border", menu, // *** TabbedPane //"TabbedPane.contentBorderInsets", new InsetsUIResource(1,1,2,2), //"TabbedPane.tabInsets", new InsetsUIResource(4,8,4,4), //"TabbedPane.tabAreaInsets", new InsetsUIResource(5,5,0,5), //"TabbedPane.tabRunOverlay", new Integer(30), "TabbedPane.contentBorderInsets", new InsetsUIResource(1,1,2,2), "TabbedPane.tabInsets", new InsetsUIResource(3,3,3,3), "TabbedPane.tabAreaInsets", new InsetsUIResource(6,2,0,2), "TabbedPane.selectedTabPadInsets", new InsetsUIResource(4,2,0,2), "TabbedPane.tabRunOverlay", new Integer(1), }; table.putDefaults(defaults); } public UIDefaults getDefaults() { UIDefaults table = super.getDefaults(); if(oyoahaTheme!=null) { oyoahaTheme.installUIDefaults(this, table); } else { try { //try to load a theme File f = new File(System.getProperty("user.home"), ".lnf" + File.separatorChar + "oyoaha" + File.separatorChar + "default.ini"); if(f.exists()) { Properties p = new Properties(); InputStream in = new FileInputStream(f); p.load(in); in.close(); String otm = p.getProperty("oyoahatheme"); if(otm!=null) { f = new File(otm); if(!f.exists()) { f = new File(System.getProperty("user.home"), ".lnf" + File.separatorChar + "oyoaha" + File.separatorChar + otm); } if(f.exists()) { setOyoahaTheme(f); oyoahaTheme.installUIDefaults(this, table); } } } } catch(Exception ex) { } } Object s1 = table.get("oyoaha.animated"); if(s1!=null && s1.toString().equalsIgnoreCase("true")) { OyoahaUtilities.initializeAnimation(true, true); } Object s2 = table.get("Sound.pressed"); Object s3 = table.get("Sound.scrolled"); OyoahaUtilities.initializeSound((s2!=null)? s2.toString() : null, (s3!=null)? s3.toString() : null); return table; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -