Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Chora authored and Chora committed Jul 8, 2016
1 parent 533f343 commit 3cbceaa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 63 deletions.
73 changes: 11 additions & 62 deletions src/com/ms509/ui/menu/DBPopMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.BufferedWriter;
Expand Down Expand Up @@ -105,93 +106,41 @@ public static void init_menu(String u,String p,String conf,int t,String c)
code = c;
}
// 数据库列表菜单
class DBMenu implements MouseListener {
class DBMenu extends MouseAdapter {

@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
// System.out.println("11");
TreePath index = tree.getPathForLocation(e.getX(), e.getY());
tree.setSelectionPath(index);
// System.out.println(tree.getSelectionCount());
int pathcount = 0;
try {
pathcount = tree.getSelectionPath().getPathCount();
// System.out.println(pathcount);
pathcount = index.getPathCount();
} catch (Exception k) {
System.out.println("点击事件,未获取到count");
pathcount = 0;
}
if (e.isMetaDown() && tree.getSelectionPath() != null && pathcount > 2) {
// System.out.println(tree.getSelectionPath());
if (e.isMetaDown() && pathcount > 2) {
tree.setSelectionPath(index);
dbmenu2.show(tree, e.getX(), e.getY());
} else if (e.isMetaDown() && tree.getSelectionPath() != null && pathcount == 2) {
} else if (e.isMetaDown() && pathcount == 2) {
tree.setSelectionPath(index);
dbmenu.show(tree, e.getX(), e.getY());
}

}

@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub

}

}

// 列表菜单
class TBmenu implements MouseListener {
class TBmenu extends MouseAdapter {

@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub

int row = table.rowAtPoint(e.getPoint());
table.setRowSelectionInterval(row,row);
if (e.isMetaDown() && table.getSelectedRow() >= 0) {
dbmenu3.show(table, e.getX(), e.getY());
}
}

@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub

}

}

// 菜单点击事件
Expand Down
2 changes: 1 addition & 1 deletion src/com/ms509/ui/panel/DatabasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public void run() {// normal
root.removeAllChildren();
DefaultTreeModel model = new DefaultTreeModel(root);
dblist.setModel(model);
dblist.updateUI();
// dblist.updateUI();
t_locker = 0;
}
// SwingUtilities.invokeLater(new Runnable() {
Expand Down

0 comments on commit 3cbceaa

Please sign in to comment.