//给Frame添加标题图片 Image im = frame.getToolkit().createImage(getImageUrl("begin.png")); frame.setIconImage(im); //自动滚动到最后一条 int currRow = this.getRowCount() - 1; table.setRowSelectionInterval(currRow, currRow);// 选中某几行 Rectangle rect = table.getCellRect(currRow, 2, true); table.scrollRectToVisible(rect); Jdialog居中:setLocationRelativeTo(frame); //该代码片段用于保存一些设置参数,下次打开时可以将值从本地中读出来 Preferences node = Preferences.userNodeForPackage(FinalParam.class); pageRowNumStr = node.get(PAGEROWNUMMAX, "50");//这个是如果没有就使用默认值 node.put(PAGEROWNUMMAX, pageRowNumStr);//保存 //以下代码为等待窗口的实现,改类继承JWindiow,gifPath为动态gif的路径 public WaitingWindow(final JFrame f, String gifPath) { super(f); JLabel waitLabel = new JLabel(new ImageIcon(this.getClass() .getResource(gifPath))); getContentPane().setLayout(new BorderLayout()); getContentPane().add(waitLabel, BorderLayout.CENTER); getContentPane().setSize(500, 400); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension labelSize = waitLabel.getPreferredSize(); setLocation((screenSize.width - labelSize.width) / 2, (screenSize.height - labelSize.height) / 2); pack(); }