📄 myframe.java
字号:
/**
*
*/
package flow.graph.test;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.io.IOException;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.plaf.metal.DefaultMetalTheme;
import javax.swing.plaf.metal.MetalLookAndFeel;
import com.jgoodies.looks.Options;
import com.jgoodies.looks.demo.Settings;
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
import flow.graph.gui.graph.GraphManager;
/**
* @author Administrator
*
*/
public class MyFrame extends JFrame{
public MyFrame(){
super("背景图片测试");
configureUI();
setSize(500,350);
//getContentPane().setLayout(new FlowLayout());
setDefaultCloseOperation(EXIT_ON_CLOSE);
//this.setContentPane(new MyPanel("background.gif"));
//this.setContentPane(new JScrollPane(new GraphManager(null)));
this.setContentPane(new GraphManager());
/*
JScrollPane sp = new JScrollPane();
MyViewPort view = new MyViewPort();
try {
view.setBackgroundTexture(MyFrame.class.getResource("background.gif"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//sp.setOpaque(false);
sp.setViewport(view);
this.setContentPane(sp);
*/
//new GetToolBar(this.getRootPane());
//createToolBar();
this.setVisible(true);
}
public static void main(String[] args){
new MyFrame();
}
public void configureUI(){
Settings settings = Settings.createDefault();
Options.setDefaultIconSize(new Dimension(18, 18));
Options.setUseNarrowButtons(settings.isUseNarrowButtons());
// Global options
Options.setTabIconsEnabled(settings.isTabIconsEnabled());
UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY,
settings.isPopupDropShadowEnabled());
// Swing Settings
LookAndFeel selectedLaf = settings.getSelectedLookAndFeel();
if (selectedLaf instanceof PlasticLookAndFeel) {
PlasticLookAndFeel.setPlasticTheme(settings.getSelectedTheme());
PlasticLookAndFeel.setTabStyle(settings.getPlasticTabStyle());
PlasticLookAndFeel.setHighContrastFocusColorsEnabled(
settings.isPlasticHighContrastFocusEnabled());
} else if (selectedLaf.getClass() == MetalLookAndFeel.class) {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
}
// Work around caching in MetalRadioButtonUI
JRadioButton radio = new JRadioButton();
radio.getUI().uninstallUI(radio);
JCheckBox checkBox = new JCheckBox();
checkBox.getUI().uninstallUI(checkBox);
try {
UIManager.setLookAndFeel(selectedLaf);
} catch (Exception e) {
System.out.println("Can't change L&F: " + e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -