java in using brausing



Share on Google+Share on Google+

zeeshan khan
java in using brausing
1 Answer(s)      5 years and 10 months ago
Posted in : Java Beginners

sir, i am beginner java developer ,sir i am creat's the image viewer Jframe but not a created frame plz. halpe me give the image viewer Jframe code

View Answers

August 19, 2011 at 1:08 PM

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class SelectFile extends JFrame implements ActionListener {

   JLabel label;
   JMenuItem openItem;
   JMenuItem exitItem;
  public SelectFile() {
    setTitle("Image Viewer");
    setSize(300, 400);

    JMenuBar mbar = new JMenuBar();
    JMenu m = new JMenu("File");
    openItem = new JMenuItem("Open");
    exitItem = new JMenuItem("Exit");

    label = new JLabel();
    Container contentPane = getContentPane();
    contentPane.add(label, "Center");

  public void actionPerformed(ActionEvent evt) {
    Object source = evt.getSource();
    if (source == openItem) {
      JFileChooser chooser = new JFileChooser();
      chooser.setCurrentDirectory(new File("."));

      chooser.setFileFilter(new javax.swing.filechooser.FileFilter() {
        public boolean accept(File f) {
            String name= f.getName().toLowerCase();
            return(name.endsWith(".jpg") || name.endsWith(".png")|| name.endsWith(".gif"));

        public String getDescription() {
          return "GIF Images";

      int r = chooser.showOpenDialog(this);
      if (r == JFileChooser.APPROVE_OPTION) {
        String name = chooser.getSelectedFile().getPath();
        label.setIcon(new ImageIcon(name));
    } else if (source == exitItem)

  public static void main(String[] args) {
    JFrame frame = new SelectFile();;



Related Tutorials/Questions & Answers:
java in using brausing
java in using brausing  sir, i am beginner java developer ,sir i am creat's the image viewer Jframe but not a created frame plz. halpe me give the image viewer Jframe code   import*; import java.awt.
using eval in Java
using eval in Java  using eval in Java
write a programm using java
write a programm using java  print the following using java programming
Using throw in java method
Using throw in java method  using throw with method implies what
A Java Program by using JSP
A Java Program by using JSP  how to draw lines by using JSP plz show me the solution by using program
survey poll using java
survey poll using java  how to make a survey poll using java? i am using netbeans and glassfish
RARP program using java
RARP program using java   hai, how to implement the RARP concept using java
java code using swings
java code using swings  code that should be able to enter data of student details using all swings into the access database using jdbc connectivity
java using Stack - Java Beginners
java using Stack  How convert decimal to binary using stack in java
Image using Java coding
Image using Java coding  Hai, Display image in pdf file using Java coding through Xsl file.. Please help me.. xsl file generate the pdf file
covert the following using java
covert the following using java  how to convert (for eg : 2.89) . this decimal to binary in java
accessing xml using java
accessing xml using java  I need to retrieve some elements in xml file using java   Hi Friend, Please visit the following links:
uSING JAVA API  How to extract Quickbooks online data using Quickbooks api( Rest ApI) write in java code ? 1.register company account 2..register application 3.get apptoken,consumer key,consumer screte can i
SMS using Java
/viewqa/Java-Beginners/15745-Sms-to-mobile-using-java-application.html ) How...SMS using Java  I am having a concern , where is the main class in, if this seems silly please let me know How to execute this java
Read XML using Java
of all i need to read xml using java . i did good research in google and came to know.../xmlParsing/java-xml-parsing-using-sax.shtml XML using Java  Hi All, Good Morning, I have been working
using java files - Java Beginners
using java files  how i use files in java to store as eg. (information about movies as its name) & when user ask about some movie the movie will come with a picture associated with it plz write me a couple of line codes
java using Stack - Java Beginners
java using Stack  How convert decimal to binary using stack in java? whats the java program or code to that. Thank you rose india and java experts  Hi Friend, Try the following code: import java.util.
JSP using java - Java Beginners
JSP using java  sir, In my jsp page contains 3 hyperlinks say (link1 link2 link3).I want to write some java code using servlet for each to forward JSP page to servlet.I m using 3 hyperlinks in my page.My
java code using while loop
java code using while loop  
Java Programming using array
Java Programming using array  I'm creating a programming using array that will accept 10 letters and test if those letters are consonant...','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Y','Z'}; char ch
java using JSP - Java Beginners
java using JSP  hi...i has been created one JSp this page have one links name as "Show datas in Excel format".I want to create Excel file... using postgres DB.This DB have more than 4 Rows and Columns.  Hi Friend
How to design a form using java?
How to design a form using java?  Please help in designing of form using java for my project
java code for PartialSearch using Map????
java code for PartialSearch using Map????  java code for Partial Search using Map
OOP using Java - Java Beginners
OOP using Java  Can you write a Java statement that creates the object mysteryClock of the Clock type, and initialize the instance variables hr,min...); } } For more information on Java visit to :
OOP Using JAVA - Java Beginners
OOP Using JAVA  OBJECT ORIENTED PROGRAMMING USING JAVA (hope guys u will help me please i need your help,thank you so much) Create a Java program...(); oops.OopType(); } } For more information on Java visit to : http
Video streaming using java
Video streaming using java  I want to create a website based on video streaming.The user has to pay and watch the videos stored in the server.So we have to stream the video in the server side and send that to the client side
Using swing - Java Beginners
Using swing  How can one use inheritance and polymophism while developing GUI of this question. Develop an application that allows a student to open an account. The account may be a savings account or a current account
JSP using java - Hibernate
JSP using java  This is my part of Excal sheet code using jdbc connection. int index=1; while( using hibernate.I am having function called displayIps() and displayvalues
Java using Jsp - Java Beginners
Java using Jsp  hi sir, again i m getting error like. HSSFWorkbook cannot be resolved to a type. HSSFSheet cannot be resolved to a type. HSSFRow cannot be resolved to a type I included Maximum all jar file in eclipse
Matrix Addition using RMI in Java
Matrix Addition using RMI in Java  Source Code for Matrix Addition using RMI in Java
Without Using Form in Java Script
Without Using Form in Java Script  HOw to Reset the data in javascript without using form tag