📄 enterqq.java
字号:
import java.io.*;
import java.awt.*;
import java.util.*;
import java.net.URL;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.border.*;
import java.awt.event.*;
public class EnterQQ extends JFrame implements ActionListener
{
private JTable table;
private JLabel label1,label2;
private JButton startQQ,manage,up,down,help,exit;
private int x,y;
private JPopupMenu menu;
private JMenuItem[] item;
private static JButton start,option;
private static Vector<QQData> qqData;
private static QQTableModel model;
private static Options options;
public static String password;
public static Image backA,backB;
public static ImageIcon CODE;
public static ImageIcon ICON;
public static ImageIcon WRONG;
public static ImageIcon WARNING;
public static Color GridColor;
public static final Toolkit KIT=Toolkit.getDefaultToolkit();
public static final Font FONT=new Font("宋体",Font.PLAIN,12);
public EnterQQ()
{
super("QQ自动登录器");
/*try
{
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.GTKLookAndFeel");
}
catch(Exception ee)
{}*/
UIManager.put("Label.font",FONT);
UIManager.put("Button.font",FONT);
UIManager.put("PasswordField.font",FONT);
UIManager.put("Table.font",FONT);
UIManager.put("TextArea.font",FONT);
UIManager.put("TextField.font",FONT);
UIManager.put("CheckBox.font",FONT);
UIManager.put("ComboBox.font",FONT);
UIManager.put("TabbedPane.font",FONT);
UIManager.put("MenuItem.font",FONT);
UIManager.put("Menu.font",FONT);
UIManager.put("Viewport.background",Color.white);
URL iconU=this.getClass().getResource("icon.png");
ICON=new ImageIcon(iconU);
this.setIconImage(KIT.getImage(this.getClass().getResource("icons.png")));
URL codeU=this.getClass().getResource("code.png");
CODE=new ImageIcon(codeU);
URL wrongU=this.getClass().getResource("wrong.png");
WRONG=new ImageIcon(wrongU);
URL warnU=this.getClass().getResource("warning.png");
WARNING=new ImageIcon(warnU);
URL backAU=this.getClass().getResource("back.png");
backA=KIT.getImage(backAU);
URL backBU=this.getClass().getResource("down.png");
backB=KIT.getImage(backBU);
password="";
Dimension size=KIT.getScreenSize();
x=(int)(size.getWidth()/2-168);
y=(int)(size.getHeight()/2-182);
options=loadOptions();
qqData=loadQQData();
if(options.isCodeNeeded())
{
CodeNeedDialog dialog=new CodeNeedDialog(null,350,240);
if(dialog.getCode()==null||!dialog.getCode().equals(password))
{
JOptionPane.showMessageDialog(null," 程序密码不正确!","错误信息",JOptionPane.INFORMATION_MESSAGE,WRONG);
System.exit(0);
}
}
menu=new JPopupMenu();
item=new JMenuItem[5];
JMenu inside=new JMenu(" 登录为..");
menu.add(inside);
menu.addSeparator();
item[0]=new JMenuItem();
item[1]=new JMenuItem(" 删除");
item[2]=new JMenuItem("QQ");
item[3]=new JMenuItem("TM");
item[4]=new JMenuItem("QQ游戏");
menu.add(item[0]);
menu.add(item[1]);
inside.add(item[2]);
inside.add(item[3]);
inside.add(item[4]);
for(int i=0;i<item.length;i++)
{
item[i].addActionListener(this);
}
start=new JButton("启动账号");
startQQ=new JButton("启动QQ");
manage=new JButton("账号管理");
manage.setFont(FONT);
up=new JButton("上移");
up.setEnabled(false);
down=new JButton("下移");
down.setEnabled(false);
option=new JButton("设定");
help=new JButton("关于/帮助");
exit=new JButton("退出程序");
Insets inset=new Insets(0,0,0,0);
startQQ.setMargin(inset);
start.setMargin(inset);
manage.setMargin(inset);
up.setMargin(inset);
down.setMargin(inset);
option.setMargin(inset);
help.setMargin(inset);
exit.setMargin(inset);
startQQ.addActionListener(this);
start.addActionListener(this);
manage.addActionListener(this);
up.addActionListener(this);
down.addActionListener(this);
option.addActionListener(this);
help.addActionListener(this);
exit.addActionListener(this);
ImagePanel backAPanel=new ImagePanel(backA);
backAPanel.setBounds(0,0,332,44);
model=new QQTableModel(qqData);
table=new JTable(model);
table.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
table.addMouseListener
(
new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
if(e.getButton()==MouseEvent.BUTTON3)
{
int row=table.rowAtPoint(e.getPoint());
if(row!=-1)
{
boolean hide=((QQData)qqData.get(row)).isHide();
item[0].setText(hide?"√隐身":" 隐身");
table.setRowSelectionInterval(row,row);
menu.show(table,e.getX(),e.getY());
}
return;
}
int row=table.getSelectedRow();
if(table.isColumnSelected(QQTableModel.CHECK_COLUMN))
{
model.fireTableDataChanged();
table.setRowSelectionInterval(row,row);
}
else if(e.getClickCount()>=2)
{
QQData qq=qqData.get(row);
StartQQ go=new StartQQ(options.getPath(qq.getType()),qq,options.getDelay());
go.start();
if(options.isClose())
System.exit(0);
}
upAndDownEnabled(row);
}
}
);
table.setRowHeight(20);
table.setDefaultRenderer(JLabel.class,new LabelCellRenderer(qqData));
TableColumn checkColumn=table.getColumn("");
checkColumn.setMaxWidth(20);
TableColumn md5Column=table.getColumn("MD5值");
table.removeColumn(md5Column);
JScrollPane pane=new JScrollPane(table);
JPanel button=new JPanel();
button.setLayout(new GridLayout(8,1,0,12));
button.add(start);
button.add(startQQ);
button.add(manage);
button.add(up);
button.add(down);
button.add(option);
button.add(help);
button.add(exit);
JPanel panel=new JPanel();
panel.setLayout(null);
pane.setBounds(5,20,220,250);
button.setBounds(235,22,75,246);
panel.add(pane);
panel.add(button);
panel.setBorder(new TitledBorder(null,"请您选择要启动的账号",TitledBorder.LEADING,TitledBorder.TOP,FONT,Color.orange.darker()));
panel.setBounds(5,45,322,280);
label1=new JLabel("广告位");
label1.setForeground(Color.blue);
label1.setBounds(5,330,50,20);
label2=new JLabel("--Shimily 制作--");
label2.setForeground(Color.GRAY);
label2.setBounds(230,330,100,20);
GridColor=label1.getBackground();
table.setGridColor(GridColor);
ImagePanel backBPanel=new ImagePanel(backB);
backBPanel.setBounds(0,355,332,47);
setLayout(null);
add(backAPanel);
add(panel);
add(label1);
add(label2);
add(backBPanel);
addWindowListener
(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
saveQQData();
saveOptions();
System.exit(0);
}
}
);
if(table.getRowCount()<1)
start.setEnabled(false);
setBounds(x,y,337,429);
setResizable(false);
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
Object o=e.getSource();
if(o==start)
{
for(int r=0;r<table.getRowCount();r++)
{
if((Boolean)table.getValueAt(r,0))
{
QQData qq=qqData.get(r);
StartQQ go=new StartQQ(options.getPath(qq.getType()),qq,options.getDelay());
go.start();
}
}
if(options.isClose())
System.exit(0);
}
else if(o==startQQ)
{
StartQQ go=new StartQQ(options.getQQPath(),null,options.getDelay());
go.start();
}
else if(o==manage)
{
if(options.isSafeClose())
{
CodeNeedDialog dialog=new CodeNeedDialog(this,x,y);
if(dialog.getCode()==null)
return;
else if(dialog.getCode().equals(password))
{
new ManageDialog(this);
}
else
{
KIT.beep();
JOptionPane.showMessageDialog(null," 密码不正确,请重新输入!","警告信息",JOptionPane.WARNING_MESSAGE,WARNING);
}
}
else
{
new ManageDialog(this);
}
}
else if(o==up)
{
int row=table.getSelectedRow();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -