📄 xframe.java
字号:
/****************************************************************
* XBrowser - eXtended web Browser *
* *
* Copyright (c) 2000-2001 Armond Avanes *
* Refer to ReadMe & License files for more information *
* *
* *
* By: Armond Avanes *
* Armond555@yahoo.com & Armond333@yahoo.com *
* http://xbrowser.sourceforge.net/ *
*****************************************************************/
package xbrowser.widgets;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.beans.*;
import xbrowser.*;
public class XFrame extends JFrame implements PropertyChangeListener
{
public XFrame()
{
XRepository.getConfiguration().addPropertyChangeListener(this);
addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
XFrame.this.windowClosing();
}
});
doEscapeCloseSupport();
}
protected void doEscapeCloseSupport()
{
getRootPane().registerKeyboardAction( new ActionListener() {
public void actionPerformed(ActionEvent actionEvent)
{
setVisible(false);
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
protected void windowClosing()
{
}
public void setVisible(boolean b)
{
if( b==true )
provideShowingPreliminaries();
else
provideHidingPreliminaries();
super.setVisible(b);
}
protected void provideShowingPreliminaries()
{
Rectangle bounds = XRepository.getConfiguration().getScreenBounds(this);
if( bounds==null )
{
centralizeScreen();
bounds = getBounds();
}
else
setBounds(bounds);
XRepository.getConfiguration().setScreenBounds(this, bounds);
}
protected void centralizeScreen()
{
Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
Dimension size = getSize();
setLocation((screen_size.width - size.width) / 2, (screen_size.height - size.height) / 2);
}
protected void provideHidingPreliminaries()
{
XRepository.getConfiguration().setScreenBounds(this, getBounds());
}
public void propertyChange(PropertyChangeEvent evt)
{
String prop_name = evt.getPropertyName();
if( prop_name.equals("ActiveLNF") || prop_name.equals("ActiveTheme") )
updateLookAndFeel();
}
protected void updateLookAndFeel()
{
SwingUtilities.updateComponentTreeUI(this);
}
/** Simple proxies */
protected ImageIcon buildImageIcon(Object owner, String icon_key)
{
return XRepository.getComponentBuilder().buildImageIcon(owner, icon_key);
}
protected JMenu buildMenu(Object owner, String key)
{
return XRepository.getComponentBuilder().buildMenu(owner, key);
}
protected JMenuItem buildMenuItem(XAction action)
{
return XRepository.getComponentBuilder().buildMenuItem(action);
}
protected JCheckBoxMenuItem buildCheckBoxMenuItem(XAction action)
{
return XRepository.getComponentBuilder().buildCheckBoxMenuItem(action);
}
protected JLabel buildLabel(Object owner, String key)
{
return XRepository.getComponentBuilder().buildLabel(owner, key);
}
protected JLabel buildLabel(Object owner, String key, int align)
{
return XRepository.getComponentBuilder().buildLabel(owner, key, align);
}
protected JCheckBox buildCheckBox(Object owner, String key)
{
return XRepository.getComponentBuilder().buildCheckBox(owner, key);
}
protected JCheckBox buildCheckBox(Object owner, String key, boolean selected)
{
return XRepository.getComponentBuilder().buildCheckBox(owner, key, selected);
}
protected JRadioButton buildRadioButton(Object owner, String key)
{
return XRepository.getComponentBuilder().buildRadioButton(owner, key);
}
protected JRadioButton buildRadioButton(Object owner, String key, String arg1, String arg2)
{
return XRepository.getComponentBuilder().buildRadioButton(owner, key, arg1, arg2);
}
protected JButton buildButton(XAction action)
{
return XRepository.getComponentBuilder().buildButton(action);
}
protected JButton buildToolbarButton(XAction action)
{
return XRepository.getComponentBuilder().buildToolbarButton(action);
}
protected JButton buildFlatButton(XAction action, int width, int height)
{
return XRepository.getComponentBuilder().buildFlatButton(action, width, height);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -