📄 lafplugin.java
字号:
package com.valhalla.jbother.plugins;import javax.swing.*;import java.util.*;import java.awt.*;import javax.swing.*;import com.valhalla.settings.*;import com.valhalla.gui.*;import com.valhalla.jbother.*;import com.valhalla.jbother.preferences.*;import com.valhalla.pluginmanager.*;/** * This plugin provides some new Look And Feels to choose from. * If this plugin is loaded correctly, you can choose new Look and Feels from * the Appearance Preferences * * @author Adam Olsen * @version 1.0*/public class LAFPlugin implements Plugin{ /** * Initialize the plugin - add the new Look and Feels */ public boolean init() { UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels(); ArrayList list = new ArrayList(); for( int i = 0; i < lafs.length; i++ ) { if( lafs[i] != null ) { list.add( lafs[i] ); } } // add the new look and feels list.add( new UIManager.LookAndFeelInfo( "Metouia", "net.sourceforge.mlf.metouia.MetouiaLookAndFeel" ) ); list.add( new UIManager.LookAndFeelInfo( "Plastic", "com.jgoodies.plaf.plastic.PlasticLookAndFeel" ) ); list.add( new UIManager.LookAndFeelInfo( "Plastic 3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel" ) ); list.add( new UIManager.LookAndFeelInfo( "Plastic XP", "com.jgoodies.plaf.plastic.PlasticXPLookAndFeel" ) ); UIManager.LookAndFeelInfo[] infos = new UIManager.LookAndFeelInfo[list.size()]; list.toArray( infos ); UIManager.setInstalledLookAndFeels( infos ); if( Arguments.getInstance().getProperty( "laf" ) == null ) JBotherLoader.loadLAF(); com.valhalla.Logger.debug( "Look and Feel plugin initiated." ); return true; } /** * Unloads the plugin */ public void unload() { String systemLAF = UIManager.getSystemLookAndFeelClassName(); try { UIManager.setLookAndFeel( systemLAF ); } catch( Exception e ) { com.valhalla.Logger.debug( "Could not load look and feel settings.\n" + e.getMessage() ); } updateUI(); UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels(); ArrayList list = new ArrayList(); for( int i = 0; i < lafs.length; i++ ) { if( lafs[i] != null ) { String name = lafs[i].getName(); if( name.equals( "Metouia" ) || name.equals( "Plastic" ) || name.equals( "Plastic XP" ) || name.equals( "Plastic 3D" ) ) { lafs[i] = null; } else { list.add( lafs[i] ); } } } UIManager.LookAndFeelInfo[] infos = new UIManager.LookAndFeelInfo[list.size()]; list.toArray( infos ); UIManager.setInstalledLookAndFeels( infos ); } private void updateUI() { SwingUtilities.updateComponentTreeUI( BuddyList.getInstance() ); SwingUtilities.updateComponentTreeUI( BuddyList.getInstance().getBuddyListTree() ); for( int i = 0; i < DialogTracker.getInstance().size(); i ++ ) { Component comp = (Component)DialogTracker.getInstance().get( i ); SwingUtilities.updateComponentTreeUI( comp ); } Vector panels = MessageDelegator.getInstance().getPanels(); for( int i = 0; i < panels.size(); i++ ) { Component comp = (Component)panels.get( i ); SwingUtilities.updateComponentTreeUI( comp ); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -