📄 mainframe.java
字号:
package jin.app;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import jin.login.*;
import jin.view.*;
public class MainFrame extends JFrame //implements ActionListener
{
public MainFrame()
{
Login login=new Login(this);
this.setTitle("登陆界面...");
this.setLocation(100,0);
this.setSize(730,750);
this.setVisible(true);
}
public static void main(String args[])
{
new MainFrame();
}
/*
private JMenu menu;
private JMenuBar menuBar;
private JMenuItem open;
private JToolBar toolBar;
private JPanel imagePanel;
private JLabel picture;
private Icon icon;
public MyFrame()
{
menu=getMenu();
menuBar=new JMenuBar();
menuBar.add(menu);
imagePanel=new JPanel();
icon=new ImageIcon("garden7.jpg");
picture=new JLabel(icon);
toolBar=createToolBar();
imagePanel.add(picture);
add(toolBar,BorderLayout.NORTH);
this.add(imagePanel);
this.setJMenuBar(menuBar);
this.setLocation(100,50);
this.setSize(850,700);
this.setVisible(true);
}
public JMenu getMenu()
{
JMenu menu=new JMenu("菜单");
open=new JMenuItem("登陆界面");
open.addActionListener(this);
menu.add(open);
return menu;
}
public JMenuItem getMenuItem()
{
return open;
}
//主函数
public static void main(String args[])
{
MyFrame myFrame=new MyFrame();
}
public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("登陆界面"))
{
Login login=new Login(this);
imagePanel.hide();
}
}
public JToolBar createToolBar()
{
JToolBar toolBar=new JToolBar();
ImageIcon imageIcon1=new ImageIcon("garden2.jpg");
JButton button1=new JButton(imageIcon1);
ImageIcon imageIcon2=new ImageIcon("img.jpg");
JButton button2=new JButton(imageIcon2);
toolBar.add(button1);
toolBar.add(button2);
return toolBar;
}
public void HidePanel()
{
imagePanel.hide();
}*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -