9 Replies - 1050 Views - Last Post: 10 June 2012 - 06:03 AM Rate Topic: -----

#1 zaidi86  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 09-June 12

how to upload a picture in my main frame window

Posted 09 June 2012 - 11:17 AM


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;

public class frmAdminMDI extends JFrame implements ActionListener {

    private JMenuBar menubar;
    private JMenu mnuAccounts;
    private JMenu mnuStdDetails;
    private JMenu mnuView;
    private JMenu mnuOptions;
    private JMenu mnuTools;
    private JMenu mnuAttendance;
    private JMenuItem mnuPresent;
    private JMenuItem mnuAbsent;
    private JMenuItem mnuNewUser;
    private JMenuItem mnuEditUser;
    private JMenuItem mnuDeleteUser;
    private JMenuItem mnuNewReg;
    private JMenuItem mnuEditReg;
    private JMenuItem mnuDelDetails;
    private JMenuItem mnuEditMark;
    private JMenuItem mnuViewStdDetails;
    private JMenuItem mnuMemList;
    private JMenuItem mnuMarkList;
    private JMenuItem mnuAddSubs,mnuEditSubs,mnuDelSubs;
    private JMenuItem mnuSubAlloc;
    private JMenuItem mnuCalc,  mnuNotepad;
    public static JDesktopPane desktop;

    public frmAdminMDI() {
        super("Indus International University");
        this.setSize(Settings.getScreenSize().width, Settings.getScreenSize().height - 30);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        setIconImage(new ImageIcon(ClassLoader.getSystemResource("images/appicon.png")).getImage());
        setExtendedState(MAXIMIZED_BOTH);
        desktop = new JDesktopPane();
        menubar = new JMenuBar();
        mnuAccounts = new JMenu("Accounts");
        mnuAttendance = new JMenu("Attendance");
        mnuStdDetails = new JMenu("Student details");
        mnuView = new JMenu("View");
        mnuOptions=new JMenu("Options");
        mnuTools = new JMenu("Tools");

        mnuNewUser = new JMenuItem("New User");
        mnuPresent = new JMenuItem ("Present");
        mnuAbsent = new JMenuItem ("Absent");
        mnuEditUser = new JMenuItem("Edit User");
        mnuDeleteUser = new JMenuItem("Delete User");
        mnuNewReg = new JMenuItem("New Registration");
        mnuEditReg = new JMenuItem("Edit Registration");
        mnuDelDetails = new JMenuItem("Delete Details");
        mnuEditMark = new JMenuItem("Edit Mark");
        mnuViewStdDetails = new JMenuItem("Student Details");
        mnuMemList = new JMenuItem("Member List");
        mnuMarkList = new JMenuItem("Mark List");
        mnuAddSubs=new JMenuItem("Add Subjects");
        mnuEditSubs=new JMenuItem("Edit Subjects");
        mnuDelSubs=new JMenuItem("Delete Subjects");
        mnuSubAlloc=new JMenuItem("Subject Allocation");
        mnuNotepad = new JMenuItem("Calculator");
        mnuCalc = new JMenuItem("Calculator");

        mnuAccounts.add(mnuNewUser);
        mnuNewUser.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F2, KeyEvent.ALT_MASK));
        mnuNewUser.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/user.png")));
        
        mnuAccounts.add(mnuEditUser);
        mnuEditUser.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, KeyEvent.ALT_MASK));
        mnuEditUser.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/editusr.png")));
        mnuAccounts.addSeparator();
        
        mnuAccounts.add(mnuDeleteUser);
        mnuDeleteUser.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, KeyEvent.ALT_MASK));
        mnuDeleteUser.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/delusr.png")));
        
        mnuStdDetails.add(mnuNewReg);
        mnuNewReg.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK));
        mnuNewReg.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/newreg.png")));
        
        mnuStdDetails.add(mnuEditReg);
        mnuEditReg.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_MASK));
        mnuEditReg.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/editreg.png")));
        
        mnuStdDetails.add(mnuDelDetails);
        mnuDelDetails.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, KeyEvent.CTRL_MASK));
        mnuDelDetails.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/delreg.png")));
        mnuStdDetails.addSeparator();
        
        mnuStdDetails.add(mnuEditMark);
        mnuEditMark.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_MASK));
        mnuEditMark.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/editmark.png")));
        
        mnuView.add(mnuMarkList);
        mnuMarkList.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, KeyEvent.CTRL_MASK));
        mnuMarkList.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/marklist.png")));
        
        mnuView.add(mnuMemList);
        mnuMemList.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_MASK));
        mnuMemList.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/memlist.png")));
        
        mnuView.add(mnuViewStdDetails);
        mnuViewStdDetails.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_MASK));
        mnuViewStdDetails.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/stddet.png")));
        
        mnuAttendance.add(mnuPresent);
        mnuPresent.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F2, KeyEvent.ALT_MASK));
        mnuPresent.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/user.png")));
        
        
        mnuAttendance.add(mnuAbsent);
        mnuAttendance.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.CTRL_MASK));
        mnuAttendance.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/user.png")));
        
        
        mnuOptions.add(mnuAddSubs);
        mnuOptions.add(mnuEditSubs);
        mnuOptions.add(mnuDelSubs);
        mnuOptions.addSeparator();
        mnuOptions.add(mnuSubAlloc);        
        mnuTools.add(mnuCalc);
        mnuCalc.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK));
        mnuCalc.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/calc.png")));
        mnuTools.add(mnuNotepad);
        mnuNotepad.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.CTRL_MASK));
        mnuNotepad.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/notepad.png")));


        menubar.add(mnuAccounts);
        menubar.add(mnuAttendance);
        menubar.add(mnuStdDetails);
        menubar.add(mnuView);
        menubar.add(mnuOptions);
        menubar.add(mnuTools);
        mnuNewUser.addActionListener(this);
        mnuEditUser.addActionListener(this);
        mnuDeleteUser.addActionListener(this);
        mnuNewReg.addActionListener(this);
        mnuEditReg.addActionListener(this);
        mnuDelDetails.addActionListener(this);
        mnuEditMark.addActionListener(this);
        mnuMarkList.addActionListener(this);
        mnuMemList.addActionListener(this);
        mnuViewStdDetails.addActionListener(this);
        mnuAddSubs.addActionListener(this);
        mnuEditSubs.addActionListener(this);
        mnuDelSubs.addActionListener(this);
        mnuSubAlloc.addActionListener(this);
        mnuCalc.addActionListener(this);        
        mnuNotepad.addActionListener(this);
        this.setJMenuBar(menubar);
        this.add(desktop);
    }//constructor closed
    public void actionPerformed(ActionEvent e) {
        try {
            if (e.getSource() == mnuNewUser) {
                NewUserReg frm = new NewUserReg();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuEditUser) {
                Edituser frm = new Edituser();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuDeleteUser) {
                Deleteuser frm = new Deleteuser();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuNewReg) {
                NewStdReg frm = new NewStdReg();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuEditReg) {
                EditStdReg frm = new EditStdReg();
                desktop.add(frm);
                frm.setVisible(true);

            }
            if (e.getSource() == mnuDelDetails) {
                Deletedetails frm = new Deletedetails();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuMarkList) {
                viewMark frm = new viewMark();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuEditMark) {
                EditMark frm = new EditMark();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuCalc) {
                Runtime.getRuntime().exec("calc.exe");
            }
            if (e.getSource() == mnuNotepad) {
                Runtime.getRuntime().exec("notepad.exe");
            }
            if (e.getSource() == mnuMemList) {
                MembersList frm = new MembersList();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuViewStdDetails) {
                User frm = new User();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if(e.getSource()==mnuAddSubs){
                AddSubjects frm=new AddSubjects();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if(e.getSource()==mnuEditSubs){
                EditSubjects frm=new EditSubjects();
                desktop.add(frm);
                frm.setVisible(true);
            }
             if(e.getSource()==mnuDelSubs){
                DelSubjects frm=new DelSubjects();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if(e.getSource()==mnuSubAlloc){
                SubjectAllocation frm=new SubjectAllocation();
                desktop.add(frm);
                frm.setVisible(true);
            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(new JFrame(), "Error, Cannot load window" + ex.toString(), "Error", JOptionPane.ERROR_MESSAGE);
        }//try catch closed
    }//actionPerformed() closed
} //class closed




Is This A Good Question/Topic? 0
  • +

Replies To: how to upload a picture in my main frame window

#2 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 870
  • View blog
  • Posts: 2,310
  • Joined: 28-March 11

Re: how to upload a picture in my main frame window

Posted 09 June 2012 - 11:19 AM

What is the problem? Just posting code is not going to get you much help. What errors are you getting? Image not displaying properly? Help us to help you!
Was This Post Helpful? 0
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8347
  • View blog
  • Posts: 31,910
  • Joined: 06-March 08

Re: how to upload a picture in my main frame window

Posted 09 June 2012 - 02:03 PM

Where in main frame window ?
On which of your component(s) is does not work ?
Was This Post Helpful? 0
  • +
  • -

#4 zaidi86  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 09-June 12

Re: how to upload a picture in my main frame window

Posted 10 June 2012 - 12:40 AM

Actually i have made my whole program with JMenu.After logging in that page directly goes to a start page where my modules are placed.
Below all of the menus, there is nothing to display,a blank space.I want to add image to that blank space,so that the program will be more worthy. Here is what i tried so far

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.beans.*;
import java.util.Random;

public class frmAdminMDI extends JFrame implements ActionListener {

    private JMenuBar menubar;
    private JMenu mnuAccounts;
    private JMenu mnuStdDetails;
    private JMenu mnuView;
    private JMenu mnuOptions;
    private JMenu mnuTools;
    private JMenu mnuAttendance;
    private JMenuItem mnuPresent;
    private JMenuItem mnuAbsent;
    private JMenuItem mnuNewUser;
    private JMenuItem mnuEditUser;
    private JMenuItem mnuDeleteUser;
    private JMenuItem mnuNewReg;
    private JMenuItem mnuEditReg;
    private JMenuItem mnuDelDetails;
    private JMenuItem mnuEditMark;
    private JMenuItem mnuViewStdDetails;
    private JMenuItem mnuMemList;
    private JMenuItem mnuMarkList;
    private JMenuItem mnuAddSubs,mnuEditSubs,mnuDelSubs;
    private JMenuItem mnuSubAlloc;
    private JMenuItem mnuCalc,  mnuNotepad;
    private JLabel label1;
    public static JDesktopPane desktop;
    
   

    public frmAdminMDI() {
        super("Indus International University");
        this.setSize(Settings.getScreenSize().width, Settings.getScreenSize().height - 30);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        setIconImage(new ImageIcon(ClassLoader.getSystemResource("images/appicon.png")).getImage());
        setExtendedState(MAXIMIZED_BOTH);

"This is what i have tried"
         
  /*       label1=new JLabel("");
         label1.setBounds(170,100,850,400);
         add(label1);
  
  
   
        label1.setDisabledIcon(new ImageIcon("images/a.jpg"));
        label1.setEnabled(false);          */
    
        desktop = new JDesktopPane();
        menubar = new JMenuBar();
        mnuAccounts = new JMenu("Accounts");
        mnuAttendance = new JMenu("Attendance");
        mnuStdDetails = new JMenu("Student details");
        mnuView = new JMenu("View");
        mnuOptions=new JMenu("Options");
        mnuTools = new JMenu("Tools");

        mnuNewUser = new JMenuItem("New User");
        mnuPresent = new JMenuItem ("Present");
        mnuAbsent = new JMenuItem ("Absent");
        mnuEditUser = new JMenuItem("Edit User");
        mnuDeleteUser = new JMenuItem("Delete User");
        mnuNewReg = new JMenuItem("New Registration");
        mnuEditReg = new JMenuItem("Edit Registration");
        mnuDelDetails = new JMenuItem("Delete Details");
        mnuEditMark = new JMenuItem("Edit Mark");
        mnuViewStdDetails = new JMenuItem("Student Details");
        mnuMemList = new JMenuItem("Member List");
        mnuMarkList = new JMenuItem("Mark List");
        mnuAddSubs=new JMenuItem("Add Subjects");
        mnuEditSubs=new JMenuItem("Edit Subjects");
        mnuDelSubs=new JMenuItem("Delete Subjects");
        mnuSubAlloc=new JMenuItem("Subject Allocation");
        mnuNotepad = new JMenuItem("Calculator");
        mnuCalc = new JMenuItem("Calculator");

        mnuAccounts.add(mnuNewUser);
        mnuNewUser.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F2, KeyEvent.ALT_MASK));
        mnuNewUser.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/user.png")));
        
        mnuAccounts.add(mnuEditUser);
        mnuEditUser.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, KeyEvent.ALT_MASK));
        mnuEditUser.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/editusr.png")));
        mnuAccounts.addSeparator();
        
        mnuAccounts.add(mnuDeleteUser);
        mnuDeleteUser.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, KeyEvent.ALT_MASK));
        mnuDeleteUser.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/delusr.png")));
        
        mnuStdDetails.add(mnuNewReg);
        mnuNewReg.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK));
        mnuNewReg.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/newreg.png")));
        
        mnuStdDetails.add(mnuEditReg);
        mnuEditReg.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_MASK));
        mnuEditReg.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/editreg.png")));
        
        mnuStdDetails.add(mnuDelDetails);
        mnuDelDetails.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, KeyEvent.CTRL_MASK));
        mnuDelDetails.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/delreg.png")));
        mnuStdDetails.addSeparator();
        
        mnuStdDetails.add(mnuEditMark);
        mnuEditMark.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_MASK));
        mnuEditMark.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/editmark.png")));
        
        mnuView.add(mnuMarkList);
        mnuMarkList.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, KeyEvent.CTRL_MASK));
        mnuMarkList.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/marklist.png")));
        
        mnuView.add(mnuMemList);
        mnuMemList.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_MASK));
        mnuMemList.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/memlist.png")));
        
        mnuView.add(mnuViewStdDetails);
        mnuViewStdDetails.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_MASK));
        mnuViewStdDetails.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/stddet.png")));
        
        mnuAttendance.add(mnuPresent);
        mnuPresent.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F2, KeyEvent.ALT_MASK));
        mnuPresent.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/user.png")));
        
        
        mnuAttendance.add(mnuAbsent);
        mnuAttendance.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.CTRL_MASK));
        mnuAttendance.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/user.png")));
        
        
        mnuOptions.add(mnuAddSubs);
        mnuOptions.add(mnuEditSubs);
        mnuOptions.add(mnuDelSubs);
        mnuOptions.addSeparator();
        mnuOptions.add(mnuSubAlloc);        
        mnuTools.add(mnuCalc);
        mnuCalc.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK));
        mnuCalc.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/calc.png")));
        mnuTools.add(mnuNotepad);
        mnuNotepad.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.CTRL_MASK));
        mnuNotepad.setIcon(new ImageIcon(ClassLoader.getSystemResource("images/notepad.png")));


        menubar.add(mnuAccounts);
        menubar.add(mnuAttendance);
        menubar.add(mnuStdDetails);
        menubar.add(mnuView);
        menubar.add(mnuOptions);
        menubar.add(mnuTools);
        mnuNewUser.addActionListener(this);
        mnuEditUser.addActionListener(this);
        mnuDeleteUser.addActionListener(this);
        mnuNewReg.addActionListener(this);
        mnuEditReg.addActionListener(this);
        mnuDelDetails.addActionListener(this);
        mnuEditMark.addActionListener(this);
        mnuMarkList.addActionListener(this);
        mnuMemList.addActionListener(this);
        mnuViewStdDetails.addActionListener(this);
        mnuAddSubs.addActionListener(this);
        mnuEditSubs.addActionListener(this);
        mnuDelSubs.addActionListener(this);
        mnuSubAlloc.addActionListener(this);
        mnuCalc.addActionListener(this);        
        mnuNotepad.addActionListener(this);
        this.setJMenuBar(menubar);
        this.add(desktop);
    }//constructor closed
    public void actionPerformed(ActionEvent e) {
        try {
            if (e.getSource() == mnuNewUser) {
                NewUserReg frm = new NewUserReg();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuEditUser) {
                Edituser frm = new Edituser();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuDeleteUser) {
                Deleteuser frm = new Deleteuser();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuNewReg) {
                NewStdReg frm = new NewStdReg();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuEditReg) {
                EditStdReg frm = new EditStdReg();
                desktop.add(frm);
                frm.setVisible(true);

            }
            if (e.getSource() == mnuDelDetails) {
                Deletedetails frm = new Deletedetails();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuMarkList) {
                viewMark frm = new viewMark();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuEditMark) {
                EditMark frm = new EditMark();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuCalc) {
                Runtime.getRuntime().exec("calc.exe");
            }
            if (e.getSource() == mnuNotepad) {
                Runtime.getRuntime().exec("notepad.exe");
            }
            if (e.getSource() == mnuMemList) {
                MembersList frm = new MembersList();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if (e.getSource() == mnuViewStdDetails) {
                User frm = new User();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if(e.getSource()==mnuAddSubs){
                AddSubjects frm=new AddSubjects();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if(e.getSource()==mnuEditSubs){
                EditSubjects frm=new EditSubjects();
                desktop.add(frm);
                frm.setVisible(true);
            }
             if(e.getSource()==mnuDelSubs){
                DelSubjects frm=new DelSubjects();
                desktop.add(frm);
                frm.setVisible(true);
            }
            if(e.getSource()==mnuSubAlloc){
                SubjectAllocation frm=new SubjectAllocation();
                desktop.add(frm);
                frm.setVisible(true);
            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(new JFrame(), "Error, Cannot load window" + ex.toString(), "Error", JOptionPane.ERROR_MESSAGE);
        }//try catch closed
    }//actionPerformed() closed
} //class closed




Was This Post Helpful? 0
  • +
  • -

#5 zaidi86  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 09-June 12

Re: how to upload a picture in my main frame window

Posted 10 June 2012 - 12:52 AM

Picture is not showing, and awt.event exception is occurred
Was This Post Helpful? 0
  • +
  • -

#6 zaidi86  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 09-June 12

Re: how to upload a picture in my main frame window

Posted 10 June 2012 - 01:17 AM

Thanks to all i am successful in adding of the image. But a new problem arises.When i select any of my menu, it appears on the image and when i close that opened menu, then the part of my image is also dismissed. I have uploaded three snaps for detailed view.Please view and guide.ThanksAttached Image
Attached Image
Attached Image
Was This Post Helpful? 0
  • +
  • -

#7 g00se  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2831
  • View blog
  • Posts: 11,996
  • Joined: 20-September 08

Re: how to upload a picture in my main frame window

Posted 10 June 2012 - 04:23 AM

I suspect your problem lies outside the code you posted. In a case like this, you probably need to post a link to a zip of your project
Was This Post Helpful? 0
  • +
  • -

#8 zaidi86  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 09-June 12

Re: how to upload a picture in my main frame window

Posted 10 June 2012 - 04:33 AM

Through working i thought to place a background image.But i am failing to do so.Please guide how to put a background image in this code which i have applied already
Was This Post Helpful? 0
  • +
  • -

#9 zaidi86  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 09-June 12

Re: how to upload a picture in my main frame window

Posted 10 June 2012 - 04:43 AM

Here is the zip of my project.Please guide.How to add background image in frmAdminMDI.java class.Please guide

Attached File(s)

  • Attached File  src.zip (292.67K)
    Number of downloads: 20

Was This Post Helpful? 0
  • +
  • -

#10 g00se  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2831
  • View blog
  • Posts: 11,996
  • Joined: 20-September 08

Re: how to upload a picture in my main frame window

Posted 10 June 2012 - 06:03 AM

Unfortunately i can't run that as it does DB access, but my guess is that your painting errors are caused by blocking the GUI thread (e.g. by doing db access in an event handler). Time-intensive ops should be done using SwingWorker.

A tip for you: be careful about the case of file and directory names. Those matter in systems other than Windows, so getting them wrong will make your code unportable

Adding a background image is straightforward - there are code snippets for it on this site

This post has been edited by g00se: 10 June 2012 - 06:05 AM
Reason for edit:: blocking EDT

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1