Why the Image dose not show?

the program can run, however, the image just dose not show on the container, I've mad ....
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.image.*;
import java.awt.geom.*;
import javax.imageio.*;
import java.io.*;
public class gui extends JFrame{
private stack s=new stack();
private queue q1=new queue();
private queue q2=new queue();
private JRadioButton rbutton1,rbutton2,rbutton3,rbutton4,rbutton5;
private JTextArea point1,point2,infoarea;
private JButton ok ,exit;
int state=0;
private JLabel b=new JLabel(new ImageIcon("abc.jpg"));
public gui() {    
creatUserInterface();
private void creatUserInterface(){
Container contentPane=getContentPane();
contentPane.setLayout(null);
b.setBounds(0, 0,127,127);
contentPane.add(b);
rbutton1=new JRadioButton();
rbutton1.setBounds(45, 270, 20,20);
rbutton1.setBackground(Color.decode("170800"));
contentPane.add(rbutton1);
rbutton2=new JRadioButton();
rbutton2.setBounds(145, 270, 20,20);
rbutton2.setBackground(Color.decode("170800"));
contentPane.add(rbutton2);
rbutton3=new JRadioButton();
rbutton3.setBounds(245, 270, 20,20);
rbutton3.setBackground(Color.decode("170800"));
contentPane.add(rbutton3);
rbutton4=new JRadioButton();
rbutton4.setBounds(345, 270, 20,20);
rbutton4.setBackground(Color.decode("170800"));
contentPane.add(rbutton4);
rbutton5=new JRadioButton();
rbutton5.setBounds(445, 270, 20,20);
rbutton5.setBackground(Color.decode("170800"));
contentPane.add(rbutton5);
point1=new JTextArea();
point1.setBounds(585, 20, 43, 20);
contentPane.add(point1);
point2=new JTextArea();
point2.setBounds(585, 205, 43, 20);
contentPane.add(point2);
infoarea=new JTextArea();
infoarea.setBounds(30, 300, 450, 100);
infoarea.setText("click \"ok \" to start game, click \"exit \" to exit");
contentPane.add(infoarea);
ok=new JButton();
ok.setBounds(520, 255, 75, 60);
ok.setText("OK");
contentPane.add(ok);
ok.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event){          
okButton(event);
exit=new JButton();
exit.setBounds(520, 340, 75, 65);
exit.setText("EXIT");
contentPane.add(exit);
exit.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event){          
exitButton(event);
contentPane.setBackground(Color.decode("170800"));
setTitle("Change it or Not");
setSize(640, 480);
setVisible(true);
Message was edited by:
explosivealan

because the code is very long and i just cut the code i think is not related, i post all the code here, should i post the code of stack , queue and others class?My objective is to show all cardLabel as jpg, abc is to test only.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.image.*;
import java.awt.geom.*;
import javax.imageio.*;
import java.io.*;
public class gui extends JFrame{
    private stack s=new stack();                                      // a stack with 52 node to store 52 cards
    private queue q1=new queue();                                     // a queue to hold the computer player's cards
    private queue q2=new queue();                                     // a queue to hold the human player's cards
    private cardoperation op=new cardoperation();                    // contain all card operation that require to run the game       
    private handcompare hc=new handcompare();                        // pass two queue to handcompare, if the first queue defealt the second queue, return true, otherwise reture false
    private JLabel cardlabel1,cardlabel2,cardlabel3,cardlabel4,cardlabel5,cardlabel6,cardlabel7,cardlabel8,cardlabel9,cardlabel10;     // label to show the cards
    private JLabel computerpoint,playerpoint,inputbet,dollarsign;        
    private JRadioButton rbutton1,rbutton2,rbutton3,rbutton4,rbutton5;   //radio button for selecting which card to be changed
    private JTextField bet;                                               //Textfield to input the amount of bet
    private JTextArea point1,point2,infoarea;                             //textarea to show player's point and futher infomation;
    private JButton ok ,exit;                                             //button to confirm or to exit game
    int compoint=10000,playpoint=10000;                                    // integer to store the player's current point;'
    int betamount;                                                         // integer to store the current bet amount
    int state=0;                                                           // store the state of the program
    private JLabel b=new JLabel(new ImageIcon("abc.jpg"));
    public gui() {    
        super();
        creatUserInterface();
    private void creatUserInterface(){
    Container contentPane=getContentPane();   
    contentPane.setLayout(null);
    cardlabel1=new JLabel();
    cardlabel1.setBounds(50, 15, 50, 30);
    cardlabel1.setText("");
    contentPane.add(cardlabel1);
    b.setBounds(0, 0,127,127);
    contentPane.add(b);
    cardlabel2=new JLabel();
    cardlabel2.setBounds(150, 15, 50, 30);
    cardlabel2.setText("");
    contentPane.add(cardlabel2);
    cardlabel3=new JLabel();
    cardlabel3.setBounds(250, 15, 50, 30);
    cardlabel3.setText("");
    contentPane.add(cardlabel3);
    cardlabel4=new JLabel();
    cardlabel4.setBounds(350, 15, 50, 30);
    cardlabel4.setText("");
    contentPane.add(cardlabel4);
    cardlabel5=new JLabel();
    cardlabel5.setBounds(450, 15, 50, 30);
    cardlabel5.setText("");
    contentPane.add(cardlabel5);
    cardlabel6=new JLabel();
    cardlabel6.setBounds(50, 200, 50, 30);
    cardlabel6.setText("");
    contentPane.add(cardlabel6);
    cardlabel7=new JLabel();
    cardlabel7.setBounds(150, 200, 50, 30);
    cardlabel7.setText("");
    contentPane.add(cardlabel7);
    cardlabel8=new JLabel();
    cardlabel8.setBounds(250, 200, 50, 30);
    cardlabel8.setText("");
    contentPane.add(cardlabel8);
    cardlabel9=new JLabel();
    cardlabel9.setBounds(350, 200, 50, 30);
    cardlabel9.setText("");
    contentPane.add(cardlabel9);
    cardlabel10=new JLabel();
    cardlabel10.setBounds(450, 200, 50, 30);
    cardlabel10.setText("");
    contentPane.add(cardlabel10);
    rbutton1=new JRadioButton();
    rbutton1.setBounds(45, 270, 20,20);
    rbutton1.setBackground(Color.decode("170800"));
    contentPane.add(rbutton1);
    rbutton2=new JRadioButton();
    rbutton2.setBounds(145, 270, 20,20);
    rbutton2.setBackground(Color.decode("170800"));
    contentPane.add(rbutton2);
    rbutton3=new JRadioButton();
    rbutton3.setBounds(245, 270, 20,20);
    rbutton3.setBackground(Color.decode("170800"));
    contentPane.add(rbutton3);
    rbutton4=new JRadioButton();
    rbutton4.setBounds(345, 270, 20,20);
    rbutton4.setBackground(Color.decode("170800"));
    contentPane.add(rbutton4);
    rbutton5=new JRadioButton();
    rbutton5.setBounds(445, 270, 20,20);
    rbutton5.setBackground(Color.decode("170800"));
    contentPane.add(rbutton5);
    computerpoint=new JLabel();
    computerpoint.setBounds(500, 15, 80, 30);
    computerpoint.setText("computer has");
    contentPane.add(computerpoint);
    playerpoint=new JLabel();
    playerpoint.setBounds(500, 200, 80, 30);
    playerpoint.setText("you have");
    contentPane.add(playerpoint);
    inputbet=new JLabel();
    inputbet.setBounds(500, 90, 130, 20);
    inputbet.setText("please input bet here");
    contentPane.add(inputbet);   
    dollarsign=new JLabel();
    dollarsign.setBounds(510, 115, 20, 20);
    dollarsign.setText("$");
    contentPane.add(dollarsign);   
    point1=new JTextArea();
    point1.setBounds(585, 20, 43, 20);   
    contentPane.add(point1);  
    point2=new JTextArea();
    point2.setBounds(585, 205, 43, 20);
    contentPane.add(point2);  
    infoarea=new JTextArea();
    infoarea.setBounds(30, 300, 450, 100);
    infoarea.setText("click \"ok \" to start game, click \"exit \" to exit");
    contentPane.add(infoarea);
    bet=new JTextField();
    bet.setBounds(530, 115, 60, 20);
    contentPane.add(bet);  
    ok=new JButton();
    ok.setBounds(520, 255, 75, 60);
    ok.setText("OK");
    contentPane.add(ok);
    ok.addActionListener(
                new ActionListener(){
           public void actionPerformed(ActionEvent event){          
             okButton(event);
    exit=new JButton();
    exit.setBounds(520, 340, 75, 65);
    exit.setText("EXIT");
    contentPane.add(exit);
    exit.addActionListener(
                new ActionListener(){
           public void actionPerformed(ActionEvent event){          
             exitButton(event);
    contentPane.setBackground(Color.decode("170800"));
    setTitle("Change it or Not");
    setSize(640, 480);
    setVisible(true);
    private void displayLabel(){
        int a[]=new int[5];
        int b[]=new int[5];
        String a1[]=new String[5];
        String b1[]=new String[5];
        a=q1.copy_queue();
        b=q2.copy_queue();
        int i;
            for(i=0;i<5;i++){
        if(a%100==13) a1[i]="A";
else if(a[i]%100>0&&a[i]%100<10)a1[i]=String.valueOf(a[i]%100+1);
else if(a[i]%100==10)a1[i]="J";
else if(a[i]%100==11)a1[i]="Q";
else if(a[i]%100==12)a1[i]="K";
for(i=0;i<5;i++){
if(b[i]%100==13) b1[i]="A";
else if(b[i]%100>0&&b[i]%100<10)b1[i]=String.valueOf(b[i]%100+1);
else if(b[i]%100==10)b1[i]="J";
else if(b[i]%100==11)b1[i]="Q";
else if(b[i]%100==12)b1[i]="K";
cardlabel1.setText(a1[0]);
if(a[0]/100==4)
cardlabel1.setForeground(Color.PINK);
else if(a[0]/100==3)
cardlabel1.setForeground(Color.BLUE);
else if(a[0]/100==2)
cardlabel1.setForeground(Color.RED);
else if(a[0]/100==1)
cardlabel1.setForeground(Color.BLACK);
cardlabel2.setText(a1[1]);
if(a[1]/100==4)
cardlabel2.setForeground(Color.PINK);
else if(a[1]/100==3)
cardlabel2.setForeground(Color.BLUE);
else if(a[1]/100==2)
cardlabel2.setForeground(Color.RED);
else if(a[1]/100==1)
cardlabel2.setForeground(Color.BLACK);
cardlabel3.setText(a1[2]);
if(a[2]/100==4)
cardlabel3.setForeground(Color.PINK);
else if(a[2]/100==3)
cardlabel3.setForeground(Color.BLUE);
else if(a[2]/100==2)
cardlabel3.setForeground(Color.RED);
else if(a[2]/100==1)
cardlabel3.setForeground(Color.BLACK);
cardlabel4.setText(a1[3]);
if(a[3]/100==4)
cardlabel4.setForeground(Color.PINK);
else if(a[3]/100==3)
cardlabel4.setForeground(Color.BLUE);
else if(a[3]/100==2)
cardlabel4.setForeground(Color.RED);
else if(a[3]/100==1)
cardlabel4.setForeground(Color.BLACK);
cardlabel5.setText(a1[4]);
if(a[4]/100==4)
cardlabel5.setForeground(Color.PINK);
else if(a[4]/100==3)
cardlabel5.setForeground(Color.BLUE);
else if(a[4]/100==2)
cardlabel5.setForeground(Color.RED);
else if(a[4]/100==1)
cardlabel5.setForeground(Color.BLACK);
cardlabel6.setText(b1[0]);
if(b[0]/100==4)
cardlabel6.setForeground(Color.PINK);
else if(b[0]/100==3)
cardlabel6.setForeground(Color.BLUE);
else if(b[0]/100==2)
cardlabel6.setForeground(Color.RED);
else if(b[0]/100==1)
cardlabel6.setForeground(Color.BLACK);
cardlabel7.setText(b1[1]);
if(b[1]/100==4)
cardlabel7.setForeground(Color.PINK);
else if(b[1]/100==3)
cardlabel7.setForeground(Color.BLUE);
else if(b[1]/100==2)
cardlabel7.setForeground(Color.RED);
else if(b[1]/100==1)
cardlabel7.setForeground(Color.BLACK);
cardlabel8.setText(b1[2]);
if(b[2]/100==4)
cardlabel8.setForeground(Color.PINK);
else if(b[2]/100==3)
cardlabel8.setForeground(Color.BLUE);
else if(b[2]/100==2)
cardlabel8.setForeground(Color.RED);
else if(b[2]/100==1)
cardlabel8.setForeground(Color.BLACK);
cardlabel9.setText(b1[3]);
if(b[3]/100==4)
cardlabel9.setForeground(Color.PINK);
else if(b[3]/100==3)
cardlabel9.setForeground(Color.BLUE);
else if(b[3]/100==2)
cardlabel9.setForeground(Color.RED);
else if(b[3]/100==1)
cardlabel9.setForeground(Color.BLACK);
cardlabel10.setText(b1[4]);
if(b[4]/100==4)
cardlabel10.setForeground(Color.PINK);
else if(b[4]/100==3)
cardlabel10.setForeground(Color.BLUE);
else if(b[4]/100==2)
cardlabel10.setForeground(Color.RED);
else if(b[4]/100==1)
cardlabel10.setForeground(Color.BLACK);
point1.setText("$"+String.valueOf(compoint)); //show the value back if player has change it accdentially
point2.setText("$"+String.valueOf(playpoint));
if(betamount==0)
bet.setText("");
else
bet.setText(String.valueOf(betamount));
private void displayHalf(){
int b[]=new int[5];
String b1[]=new String[5];
b=q2.copy_queue();
int i;
for(i=0;i<5;i++){
if(b[i]%100==13) b1[i]="A";
else if(b[i]%100>0&&b[i]%100<10)b1[i]=String.valueOf(b[i]%100+1);
else if(b[i]%100==10)b1[i]="J";
else if(b[i]%100==11)b1[i]="Q";
else if(b[i]%100==12)b1[i]="K";
cardlabel6.setText(b1[0]);
if(b[0]/100==4)
cardlabel6.setForeground(Color.PINK);
else if(b[0]/100==3)
cardlabel6.setForeground(Color.BLUE);
else if(b[0]/100==2)
cardlabel6.setForeground(Color.RED);
else if(b[0]/100==1)
cardlabel6.setForeground(Color.BLACK);
cardlabel7.setText(b1[1]);
if(b[1]/100==4)
cardlabel7.setForeground(Color.PINK);
else if(b[1]/100==3)
cardlabel7.setForeground(Color.BLUE);
else if(b[1]/100==2)
cardlabel7.setForeground(Color.RED);
else if(b[1]/100==1)
cardlabel7.setForeground(Color.BLACK);
cardlabel8.setText(b1[2]);
if(b[2]/100==4)
cardlabel8.setForeground(Color.PINK);
else if(b[2]/100==3)
cardlabel8.setForeground(Color.BLUE);
else if(b[2]/100==2)
cardlabel8.setForeground(Color.RED);
else if(b[2]/100==1)
cardlabel8.setForeground(Color.BLACK);
cardlabel9.setText(b1[3]);
if(b[3]/100==4)
cardlabel9.setForeground(Color.PINK);
else if(b[3]/100==3)
cardlabel9.setForeground(Color.BLUE);
else if(b[3]/100==2)
cardlabel9.setForeground(Color.RED);
else if(b[3]/100==1)
cardlabel9.setForeground(Color.BLACK);
cardlabel10.setText(b1[4]);
if(b[4]/100==4)
cardlabel10.setForeground(Color.PINK);
else if(b[4]/100==3)
cardlabel10.setForeground(Color.BLUE);
else if(b[4]/100==2)
cardlabel10.setForeground(Color.RED);
else if(b[4]/100==1)
cardlabel10.setForeground(Color.BLACK);
cardlabel1.setText("");
cardlabel2.setText("");
cardlabel3.setText("");
cardlabel4.setText("");
cardlabel5.setText("");
point1.setText("$"+String.valueOf(compoint)); //show the value back if player has change it accdentially
point2.setText("$"+String.valueOf(playpoint));
if(betamount==0)
bet.setText("");
else
bet.setText(String.valueOf(betamount));
private void okButton(ActionEvent event){
switch(state){
case(0):{
op.reshuffle(s);
op.CardDistribe(s, q1, q2);
displayHalf();
infoarea.setText("please input your bet and click \"ok \" \n\nSpace is Black Heart is Red \nClub is Bleu Diamond is Pink");
break;
case(1):{  
try{
betamount=Integer.parseInt(bet.getText());
catch(NumberFormatException e){
infoarea.setText("invaild input, please try again");
state=state-1;
if(state==1)
if(betamount<=0||betamount>playpoint)
{infoarea.setText("please input between 1 & "+String.valueOf(playpoint));
                       state=state-1;}
else
{infoarea.setText("please choose the cards to be changed \n\nSpace is Black    Heart is Red \nClub is Bleu         Diamond is Pink"); 
                       displayLabel();}
break;
case(2):{           
infoarea.setText("choosed card has been changed");
int a[]=new int[5];
for(int i=0;i<5;i++)
a[i]=0;
if(rbutton1.isSelected())
a[0]=1;
if(rbutton2.isSelected())
a[1]=1;
if(rbutton3.isSelected())
a[2]=1;
if(rbutton4.isSelected())
a[3]=1;
if(rbutton5.isSelected())
a[4]=1;
op.computerChangeCard(s, q1, hc);
op.playerChangeCard(s, q2, a);
displayLabel();
break;
case(3):{          
if(hc.compare(q1, q2)){
infoarea.setText("you loss\n\nclick \"ok \" to continue");
playpoint=playpoint-betamount;
compoint=compoint+betamount;
else{
infoarea.setText("you win\n\nclick \"ok \" to continue");
playpoint=playpoint+betamount;
compoint=compoint-betamount;
betamount=0;
displayLabel();
if(playpoint<=0)
infoarea.setText("you have loss the game, press \"ok \" or \"exit \" to end game");
else if(compoint<=0)
infoarea.setText("you have win the game, press \"ok \" or \"exit \" to end game");
else{
state=-1;
break;
case(4):{
exit(); // player's point <=0, so force to exit'
default:
rbutton1.setSelected(false);
rbutton2.setSelected(false);
rbutton3.setSelected(false);
rbutton4.setSelected(false);
rbutton5.setSelected(false);
state=state+1;
private void exitButton(ActionEvent event){
exit();
private void exit(){
System.exit(0);

Similar Messages

  • Why the iPhone dose not show the witting in case if the other person have a call and I'm on witting?

    Why the iPhone dose not show the witting in case if the other person have a call and I'm on witting? really I'm dissappointed with this point Why we do not have this service?

    That is not a feature of the iPhone (or of any phone I've ever had so apparently it's far from universal). Apple has not said why they have no such feature.
    You can request such a feature here:
    http://www.apple.com/feedback
    Either the person you're calling will answer you or they won't. What difference does it make why?

  • Why the Image is not showing on Report at runtime?

    Post Author: azharrahi
    CA Forum: .NET
    I am working on a web site which was developed in ASP.Net 1.1. This web site also contains Crystal Reports version 9.
    Now I have loaded the web site in Visual Studio.net 2005 and hence in ASP.Net 2.0. Still the Crystal reports version is 9.
    Everything is ok and Crystal reports are showing data properly.
    But one thing is very strange and annoyable.i.e. When I insert image on Crystal Reports through right click-> Insert->Picture, the image is shown in the design time preview of report, but when I load the Crystal Report on .Net control CrystalReportViewer and run the application, the Image is not displayed. The problem becomes more strange when I Export the Crystal Report to PDF file and MS Excel. Strangely the Image is also exported there and is displayed. Whats the problem? Why Image is not displayed on the CrystalreportViewer of the form on run time and why on exporting to PDF file and MS Excel, it is displayed? Can any body tell me whats the problem behind of not displaying image on runtime?
    At least it means that Image is embeded and loaded on runtime. Only now viewing. Only a blank Picture box displayed.

    Post Author: Argan
    CA Forum: .NET
    A couple things can cause this.
    Right click on the red x to find out the name of the png file.  Search the web server for that png and make sure that the asp worker has access to it.
    The other is a image handler issue.  Search the kbase for Red X NET 2005 and you will find a kbase or two that addresses this.

  • When I open Photoshop CS6, the image does not show in Photoshop. The image IS open, i.e. the filename is shown on a tab and the image layers show in the layer panel. What is going on?

    Both Photoshop and Bridge open as usual. But when I open an image, the image does not show in the image area. The image filename does show in a tab and the layers show in the layer panel. What is going on and how do I fix this.

    I resolved the problem. It was somehow related to my using Microsoft
    theme pictures. I set Windows to use the basic theme and the problem
    went away. Thank you for the suggestions.
    Jac

  • When I upload photos, some of the images do not show, but appear as a dotted square. has anyone had this problem?

    when I upload photos, some of the images do not show, but appear as a dotted square. has anyone had this problem?

    Hi Terence, When I am uploading photos from a memory card,not all of the photos show up on I photo as a photo image, but show up as a dotted square line. For example, I just added 12 photo from two days. The first day had 5 photos, but only 4 show up as images, then there is 1 as dotted  a square. The next day, there 7 images, with only 4 showing up as photos, and three as the dotted squares.
    I am using I photo 11, 9.1.1.
    Thank you

  • Do anyone know why the desktops do not show? Is this a bug?

    Do anyone know why the desktops do not show?

    See:
    * http://kb.mozillazine.org/Images_or_animations_do_not_load
    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • Why the Itune is not showing my iphone in it???

    I m using Iphone 5s and i want to copy songs and some other stuff from my pc to my iphone. I searched for it on google and read some discussion on the official site of APPLE, acc. to them i need Itune to do so. I downloaded it from the apple site but when i connect my Iphone to my pc then The Itune  does not show my IPhone anywhere... plz help

    Hey nrathi,
    Thanks for using Apple Support Communities.
    Follow this article since the iPhone does not appear under Devices in iTunes.
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/ts1538
    Have a nice day,
    Mario

  • Some of the images are not showing up on my Blogger blog even though the HTML is there. They do show up in Opera.

    Here is the link to the blog post -
    http://happyholidays-blog.blogspot.com/2010/09/welcome-to-trick-or-treat-street.html
    Three days ago I went to a post from last year and an image was gone. The code was there but not the image.
    It doesn't get rid of all the images just certain ones and they are consistently gone. It is not a random deletion of images.
    I have had images not show up on other blogger sites.

    See http://kb.mozillazine.org/Images_or_animations_do_not_load
    It is possible that you clicked "Block Images" in the right click context menu while trying to save an image.
    Check the image exceptions: Tools > Options > Content: Load Images: Exceptions<br />
    See [[Options window - Content panel]]
    *A way to see which images are blocked is to click the favicon (<i>Site Identification</i> icon) on the left side of the location bar.
    *A click on the "More Information" button will open the Security tab of the "Page Info" window (also accessible via "Tools > Page Info").
    *Open the <i>Media</i> tab of the "Page Info" window.
    *Select the first image and scroll down though the list with the Down arrow key.
    *If an image in the list is grayed and there is a check-mark in the box "<i>Block Images from...</i>" then remove that mark to unblock the images from that domain.

  • Why my images are not showing?

    I upload the images using file manager and it shows that the files are there. but it doesn't display. when i open the image path in a new window i get this message: "Bad Request". Can anyone help please?
    [email protected]

    Hi Alfred, so you know you will run into several issues if you do not follow naming conventions with folders and images on the web.
    If you have spaces for example this causes a lot of problems.
    That %20 stuff you see in your links are because you have spaces.
    Any time you have a space in a file or folder you should replace it with a -
    Removing them I can get a 404 error but support will only be the ones who can say if the images are uploaded correctly, they also may have not been saved correctly and are corrupted.
    But what you can try is renaming the folder to...
    granite-cobbles
    And try one of the images to be..
    sawnface-tubled-lrg.jpg
    And see if that works.

  • Why the oval is not showing up?

    heres my code:
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    public class myApplet extends java.applet.Applet {
    boolean initialization = true;
    int centerX, centerY, maxX, maxY;
    float pixelSize, rWidth = 400.0F, rHeight = 400.0F;
    BufferedImage gBuffer;
    void initializeGraphics()
    Dimension d = canvas1.getSize();
    maxX = d.width - 1; maxY = d.height - 1;
    pixelSize = Math.max((rWidth)/maxX, (rHeight)/maxY);
    centerX = maxX/2; centerY = maxY/2;
    int iX(float x){return Math.round(centerX + x/pixelSize);}
    int iY(float y){return Math.round(centerY - y/pixelSize);}
    float fx(int x){return ((x - centerX) * pixelSize);}
    float fy(int y){return ((centerY - y) * pixelSize);}
    void clearGraphics(Graphics g) {
    g.setColor(Color.WHITE);
    g.fillRect(0,0, maxX, maxY);
    /** Initializes the applet Trans2D */
    public void init() {
    try {
    java.awt.EventQueue.invokeAndWait(new Runnable() {
    public void run() {
    initComponents();
    } catch (Exception ex) {
    ex.printStackTrace();
    this.setSize(700, 700);
    gBuffer = new BufferedImage((int)rWidth, (int)rHeight, BufferedImage.TYPE_INT_ARGB);
    /** This method is called from within the init() method to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
    canvas1 = new mycanvas();
    jScrollBarPoints = new javax.swing.JScrollBar();
    jLabelNoPoints = new javax.swing.JLabel();
    canvas1.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mousePressed(java.awt.event.MouseEvent evt) {
    canvas1MousePressed(evt);
    jScrollBarPoints.setMaximum(25);
    jScrollBarPoints.setMinimum(3);
    jScrollBarPoints.setOrientation(javax.swing.JScrollBar.HORIZONTAL);
    jScrollBarPoints.addAdjustmentListener(new java.awt.event.AdjustmentListener() {
    public void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {
    jScrollBarPointsAdjustmentValueChanged(evt);
    jLabelNoPoints.setText("3");
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .addContainerGap()
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
    .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollBarPoints, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
    .add(org.jdesktop.layout.GroupLayout.LEADING, canvas1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE))
    .add(18, 18, 18)
    .add(jLabelNoPoints, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(296, 296, 296))
    layout.setVerticalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .addContainerGap()
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jLabelNoPoints)
    .add(layout.createSequentialGroup()
    .add(jScrollBarPoints, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(canvas1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 452, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
    .add(20, 20, 20))
    }// </editor-fold>
    private void canvas1MousePressed(java.awt.event.MouseEvent evt) {                                    
    // TODO add your handling code here:
    Graphics g = gBuffer.getGraphics();
    g.drawOval(evt.getX(), evt.getY(), 10, 10);
    g.fillOval(evt.getX(), evt.getY(), 10, 10);
    private void jScrollBarPointsAdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {                                                       
    jLabelNoPoints.setText(""+jScrollBarPoints.getValue());
    // Variables declaration - do not modify
    private java.awt.Canvas canvas1;
    private javax.swing.JLabel jLabelNoPoints;
    private javax.swing.JScrollBar jScrollBarPoints;
    // End of variables declaration
    public class mycanvas extends java.awt.Canvas {
    public void paint(Graphics g){
    super.paint(g);
    my question is.when i press with the mouse on canvas1 why it doesnt draw an oval in that X,Y ? How can I solve that? Thanks!

    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    public class myApplet extends java.applet.Applet {
    boolean initialization = true; 
    int centerX, centerY, maxX, maxY;
    float pixelSize, rWidth = 400.0F, rHeight = 400.0F;
    BufferedImage gBuffer;
    void initializeGraphics()
       Dimension d = canvas1.getSize();
       maxX = d.width - 1; maxY = d.height - 1;
       pixelSize = Math.max((rWidth)/maxX, (rHeight)/maxY);
       centerX = maxX/2; centerY = maxY/2;
      int iX(float x){return Math.round(centerX + x/pixelSize);}
      int iY(float y){return Math.round(centerY - y/pixelSize);}
      float fx(int x){return ((x - centerX) * pixelSize);}
      float fy(int y){return ((centerY - y) * pixelSize);}
    void clearGraphics(Graphics g) {
        g.setColor(Color.WHITE);
        g.fillRect(0,0, maxX, maxY);
        /** Initializes the applet Trans2D */
        public void init() {
            try {
                java.awt.EventQueue.invokeAndWait(new Runnable() {
                    public void run() {
                        initComponents();
            } catch (Exception ex) {
                ex.printStackTrace();
            this.setSize(700, 700);
            gBuffer = new BufferedImage((int)rWidth, (int)rHeight, BufferedImage.TYPE_INT_ARGB);
        /** This method is called from within the init() method to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
        private void initComponents() {
            canvas1 = new mycanvas();
            jScrollBarPoints = new javax.swing.JScrollBar();
            jLabelNoPoints = new javax.swing.JLabel();
            canvas1.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mousePressed(java.awt.event.MouseEvent evt) {
                    canvas1MousePressed(evt);
            jScrollBarPoints.setMaximum(25);
            jScrollBarPoints.setMinimum(3);
            jScrollBarPoints.setOrientation(javax.swing.JScrollBar.HORIZONTAL);
            jScrollBarPoints.addAdjustmentListener(new java.awt.event.AdjustmentListener() {
                public void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {
                    jScrollBarPointsAdjustmentValueChanged(evt);
            jLabelNoPoints.setText("3");
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
            this.setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                        .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollBarPoints, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
                        .add(org.jdesktop.layout.GroupLayout.LEADING, canvas1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE))
                    .add(18, 18, 18)
                    .add(jLabelNoPoints, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(296, 296, 296))
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(jLabelNoPoints)
                        .add(layout.createSequentialGroup()
                            .add(jScrollBarPoints, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(canvas1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 452, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(20, 20, 20))
        }// </editor-fold>                       
        private void canvas1MousePressed(java.awt.event.MouseEvent evt) {                                    
            Graphics g = gBuffer.getGraphics ();
            g.setColor (Color.RED);
            g.fillOval (evt.getX (), evt.getY (), 10, 10);
            g.setColor (Color.BLUE);
            g.drawOval (evt.getX(), evt.getY(), 10, 10);
        private void jScrollBarPointsAdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {                                                       
            jLabelNoPoints.setText(""+jScrollBarPoints.getValue());
        // Variables declaration - do not modify                    
        private java.awt.Canvas canvas1;
        private javax.swing.JLabel jLabelNoPoints;
        private javax.swing.JScrollBar jScrollBarPoints;
        // End of variables declaration                  
        public class mycanvas extends java.awt.Canvas {
            public void paint(Graphics g){
                super.paint (g);
                g.drawImage (gBuffer, 0, 0, null);
    }still nothing? is it so difficult to do such an easy thing?

  • I am having trouble importing photos, The images are not showing on the grid. I am only getting hourglasses.

    I just installed Photo Elements 12 and when I import my photos all I get on the grid is hourglasses, no images.  When I click on them I do get the photo but I can't see them on the grid.

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    The title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen.Click the Clear Display icon in the toolbar. Then take one of the actions that you're having trouble with. Select any messages that appear in the Console window. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    The log contains a vast amount of information, almost all of which is irrelevant to solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    Some private information, such as your name, may appear in the log. Anonymize before posting.

  • Why the subvi can not show,when i use call by reference node.

    I used a call by reference node in function pallete,i follow the labview manuals and examples(dynamic load example), but i can not see the subvi show when the program running.
    Attachments:
    comshow.vi ‏75 KB
    交流稳态频谱.vi ‏19 KB

    Hi Sunny,
    Open your subVI,
    1. go to File->Vi Properties (or Ctrl+I)
    2. choose Window Appearance category
    3. choose Customize
    4. check "Show Front Panel When Called" (and "Close Afterwards ..")
    5. save the VI, close it and try again.
    Let us know if it's OK ...

  • The images is not show in all browsers.

    hello,,
    I bought a new MacBook Pro and it is not displaying certain images in all browsers.. including safari, google chrome, mozilla firefox..
    note that when I trying to open the same page using windows OS, it opened fine!

    MacBook Pro and it is not displaying certain images in all browsers.. including safari, google chrome, mozilla firefox..
    Are you using Apple's Airport Express or Extreme ..  what kind of router ??  You must be using one to setup a wi fi network. And that can affect all your browsers.

  • Why images are not showing?

    When I add to image to slider or products, the images are not showing and wrting <tag_image no link> or <tag_list image no link>. I already match pictures to image filed on web apps.

    Hi Alfred, so you know you will run into several issues if you do not follow naming conventions with folders and images on the web.
    If you have spaces for example this causes a lot of problems.
    That %20 stuff you see in your links are because you have spaces.
    Any time you have a space in a file or folder you should replace it with a -
    Removing them I can get a 404 error but support will only be the ones who can say if the images are uploaded correctly, they also may have not been saved correctly and are corrupted.
    But what you can try is renaming the folder to...
    granite-cobbles
    And try one of the images to be..
    sawnface-tubled-lrg.jpg
    And see if that works.

  • I am trying to create an responsive HTML5 output, but images are not showing up.

    When I preview my output, the images are note showing up. It is simply the blank outline of the image with the little image icon in the top left corner.
    As it is compiling I see the message "Warning: Image maps are not converted to relative size". Is there something in the setting that I need to change, or is that even the problem?

    Can you check your output folder: are the images copied to your output? If they are missing, are the images listed in the Project Manager pod in RoboHelp?
    The warning is unrelated. Since image maps work with pixel coordinates, you can't simply make them responsive. You are probably using an image map in your project. This is causing the warning. It is not a problem since the image map will still work. But if the image map is very large, it may give a bad experience on smaller screens. You may have to decide whether to change or remove the image map if you want to support mobile.

Maybe you are looking for

  • How to install windows 8 using bootcamp?

    I am trying to install windows 8 on my Macbook Pro (Lion) using bootcamp. Of course in the bootcamp setup there is only the option to install windows 7 which I do not want, and if I try it anyways with the Win8 DVD I have it says it can't find the DV

  • More than one converter per component

    hi! I want to set to a component two converters, but, I don't know why, JSF only gets the second converter. Why? I've put the converters with <f:converter> tag. Thanks

  • Downloading Raw Images into Aperature

    This topic has to do with getting Raw images into Aperture and not the application it's self. There happens to be several ways to download images from a memory card (from the camera to the USB port, from a card reader to the USB port, from a card rea

  • Itunes won't update ipod with videos.

    Everytime i go to upload videos, my Ipod itself won't have them on there, although they'll be on my computer/itunes. Also, my ipod will delete every single video on there within a few days. How can i solve this?

  • Deployment error while upgrading from WLS6.1 to WLS9.1

    We are upgrading from Weblogic 6.1 to Weblogic 9.1. We are facing with two issues while upgrading. 1. We are having a start up servlet and that servlet uses Database appender and uses log4j. This class is inside a jar file and this jar is part of the