تصف هذه المقالة عارض الصورة الذي تم تنفيذه Java. شاركه للرجوع إليه. التفاصيل كما يلي:
1. mycanvas.java:
PackageViewer ؛ استيراد Java.Awt int image_height ؛ (this.getheight ()-Image_height)/2 ، هذا) ؛ ؛ العودة ؛ p0 "+screen_proportion) ؛ image_width = bi.getWidth (this) ؛ image_height = bi.getheight (this) ؛ double image_propirt "+image_height+" ، p1 "+image_proportion) ؛ if (image_propinter> screen_proportion) {image_height = screen_height ؛ image_width = (int) (image_height / image_p ropinord) ؛ system.out.println (" p1> p0 w = " ؛ ) ؛2. myfilter.java:
Package PictureViewer ؛ import java.io "،" .gif "،" .gif "،" .png "،" .png "،" .jpeg "،" .jpeg "؛ قبول Boolean العام (File dir ، اسم السلسلة) {for (string s: extension) {if (name.endswith (s)) {return true ؛3. PictureViewer.java:
Package PictureViewer ؛ import java.awt.*؛ استيراد java.awt.event.*؛ استيراد java.awt.image.*؛ استيراد java.io الإطار الخاص ) استثناء {New Pictreviewer (). init () ؛ زر سابق = "سابق" ؛ .add(previous); pb.add(next); mc = new MyCanvas(); mc.setBackground(new Color(200,210,230)); mc.addComponentListener(mc); frame.add(p b,"North" ); frame .Add (MC ، "المركز") ؛ }) ؛ ActionPerformed (ActionEvent e) {string command = E.GetActionCommand () ؛ ) ؛ ؛ photo ")) {findex ++ ؛ if (findEx> = files.length) findex = files.length-1 ؛ this.display (files [findEx]) ؛} this.validateButton () ؛} display public void (file f) { جرب {bufferedimage bi = imageio.read (f) ؛ printstacktrace () ؛ ؛ i ++) {if (current.equals (files [i])) {findEx = i ؛ next.setEnabled ((الملفات! = null) && (FindEx <(files.length-1))) ؛آمل أن يكون هذا المقال مفيدًا لبرمجة Java للجميع.