【正文】
} } Design of JavaBased Graphics User Interface Abstract: In this paper, we discuss the design of Javabased graphics user interface. We introduce Graphics User Interface and Swing in brief and discuss in detail the design procedure of a image viewer. To implement the image viewer, we use some standard or extended graphics interface ponents in mom use and some kinds of events processing graphics interface. Test and operation results indicate that the image viewer works well. It can open files whose format is gif、 jpg or png, and has some easy operations such as “back”、 ”next”、 ”zoom out”、 ”zoom in” and so on. Keywords: Java, Swing, Graphics User Interface, Software design 。 } } } public static void main(String args[]){ JSplashWindow splash = new JSplashWindow()。 JImageFrame image=(JImageFrame)frame。 } } } class ReloadListener implements ActionListener{ //重載原圖 JInternalFrame frame。 if(()==Zoom In) p=。 JImageFrame image=(JImageFrame)frame。 double p。 (files[i])。 } if(()==next) i=(i+1)%。 files=(filter)。 parentFile=()。 }catch (PropertyVetoException ignored) {} JImageFrame image=(JImageFrame)frame。 public void actionPerformed(ActionEvent e){ if(()!=null){ frame=()。 JInternalFrame frame。 } } } class BrowseListener implements ActionListener{ //瀏覽圖像 File parentFile,file。 } y += h。 } catch (PropertyVetoException ignored) {} } ().resizeFrame(f, x, y, w, h)。amp。 j++) { JInternalFrame f = allframes[(i * cols) + j]。amp。 i++) { for (int j = 0。 resizing each. for (int i = 0。 // Iterate over the frames, deiconifying any iconified frames and then int y = 0。 int h = / rows。 // Define some initial values for size amp。 if (rows * cols count) { rows++。 int cols = sqrt。 int sqrt = (int)(count)。 // How many frames do we have? int count = 。 repaint()。 internalX=0。 } } } public class CloseallListener implements ActionListener{ //關(guān)閉圖像窗口 public void actionPerformed(ActionEvent ec){ ()。 (imageframe,new Integer(1))。 } Icon icon = new ImageIcon(images/)。 } else{ internalX=10。 if(internalX100){ internalX+=30。 } if(file!=null){ JImageFrame imageframe=new JImageFrame((),true,true,true,true,file)。 if(returnVal == ) { file=()。 (打開圖象文件 )。 PNG Images)。 (png)。 (jpg)。 } } if(()==openItem||()==openBtn){ JFileChooser chooser = new JFileChooser()。 17 public void actionPerformed(ActionEvent e){ if(()==treeopen){ file=()。 } if(()==About Me){ //“關(guān) 于”操作 (this, About,)。 } //構(gòu)造函數(shù)完 public void actionPerformed(ActionEvent e) { if(()==Exit){ //“退出”操作 dispose()。 internalX=0。 //===================splitpane end==================== (toppane,)。 jsp=new JSplitPane(,true,treepane,desktop)。 (bottom,)。 (treeopen,)。 (Open)。 (treeopen)。 JLabel status=new JLabel(Please select a file. ^O^)。 treeEx=new TreeExplorer()。 (backgr, new Integer())。 //添加背景 backgr= new JLabel(icon)。 //===================panel end========================== //====================splitpane======================= desktop=new JDesktopPane()。 (mbar,)。 (toolbarPanel)。 (new BorderLayout())。 (tileBtn)。 (backBtn)。 (zoutBtn)。 (true)。 (tilelistener)。 JFancyButton tileBtn=new JFancyButton(new ImageIcon(images/), new ImageIcon(images/), new ImageIcon(images/))。 (next)。 JFancyButton nextBtn=new JFancyButton(new ImageIcon(images/), new ImageIcon(images/), new ImageIcon(images/))。 (back)。 JFancyButton backBtn=new JFancyButton(new ImageIcon(images/), new ImageIcon(images/), new ImageIcon(images/))。 (Zoom Out)。 JFancyButton zoutBtn=new JFancyButton(new ImageIcon(images/), new ImageIcon(images/), new ImageIcon(images/))。 (Zoom In)。 JFancyButton zinBtn=new JFancyButton(new ImageIcon(images/), new ImageIcon(images/), new ImageIcon(images/))。 (Open Files)。 //====================menu end========================== //=====================toolbar=========================== JFancyButton openBtn=new JFancyButton(new ImageIcon(images/), 15 new ImageIcon(images/), new ImageIcon(images/))。 (faceMenu)。 (fileMenu)。 (this)。 (item)。 (item=new JRadioButtonMenuItem(Windows))。 (true)。 (item=new JRadioButtonMenuItem(Metal))。 (lnfListener)。 ButtonGroup buttonGroup=new ButtonGroup()。 JMenuItem item。 ()。 (backItem)。 (zinItem)。 (tilelistener)。