Gå til innhold

"Alpha" testing av java programm...


Anbefalte innlegg

Dette programmet har jeg skrevet i Java 1.4 paa windows xp, men jeg faar feilmelding naar jeg starter programmet pa Linux med java 1.4.2 innstalert

 

men jeg far feilmeldingen at

Exception in thread "main" java.lang.IllegalArgumentException: Couldn't load image: image.png

 

Jeg faar ikke feilmeldingen paa min maskin(WinXP), dessuten har jeg ikke noe problem med og vise bilde i linux's sitt 'default' bilde behandlings programm, dessuten saa greier programmet mitt og laste inn andre png filer/bilder(f.eks bakgrunnsfargen som jeg ser foer jeg faar feilmeldingen...

 

DVS, Linux(Red Hat Fedora Core 5) greier og vise mange av bildene, men ikke "middag.png", hvorfor?

 

her er hele koden:

 

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

class QueryInfo { 
public final int MIDDAG = 1;
public final int DESERT = 2;
public final int SNACKS = 3;
 
public final int FISK = 1;
public final int KJOTT = 2;
public final int FUGL = 3;
public final int VEGETAR = 4;
public final int HURTIG = 6;
 
private int CurrentTypeRett = 0;
private int CurrentTypeUnder = 0;
 
public QueryInfo() {
}

public void setType(int TypeRett) {
 if (! (TypeRett < 1 || TypeRett > 3) ) CurrentTypeRett = TypeRett;
 CurrentTypeUnder = 0;
}

public void setUnder(int TypeUnder) {
 switch (CurrentTypeRett)  {
 	case MIDDAG:
   if (!(TypeUnder < 1 || TypeUnder > 5)) CurrentTypeUnder = TypeUnder;
   break;
 	case DESERT:
   CurrentTypeUnder = 0;
   break;
 }
}
}

class Query {
private QueryInfo QI;

public Query(QueryInfo QI) {
 this.QI = QI;
}	
}

class Form extends JFrame {
private Bakgrunn BG;
 
public Form(String title, int width, int height) {
 BG = new Bakgrunn("bakgrunn.png");
 setUndecorated(true);
 setLayout(null);
 
 addTrue(BG);
 BG.setSize(1024,768);
 BG.setLocation(0,0);
 
 setDefaultCloseOperation(EXIT_ON_CLOSE);
 setSize(width,height);
 setTitle(title);
 setResizable(false);
 //Show the form
 setVisible(true);
}

public Component add(Component controll,String strkey) {
 BG.addControll(controll,strkey);
 return controll;
}
 
public Component addTrue(Component controll) {
 super.add(controll);
 return controll;
}

public void setCurrent(String strKey) {
 BG.setCurrent(strKey);
}
public Bakgrunn getBakgrunn() {
 return BG;
}
}

class Bakgrunn extends JPanel {
private String strFileName;
private int color;
private boolean bPicture = false;
private boolean bColor = false;
private ImageIcon II = null;
 
public Bakgrunn(String strFileName) {
 this.strFileName = strFileName;
 this.bPicture = true;
 II = new ImageIcon(strFileName);
 setLayout(new CardLayout());
}

public Bakgrunn(int color) {
 this.color = color;
 this.bColor = true;
 setLayout(new CardLayout());
}

 
public Bakgrunn(Color c) {
 this.color = c.getRGB();
 this.bColor = true;
 setLayout(new CardLayout());
}

public void addControll(Component controll, String strKey) {
 add(controll, strKey);
}

public void setBakgrunn(String strFileName) {
 this.strFileName = strFileName;
 this.bPicture = true;
 II = new ImageIcon(strFileName);
}

public void setBakgrunn(int color) {
 this.color = color;
 this.bColor = true;
}

public void setCurrent(String strKey) {
 CardLayout lTemp = (CardLayout) getLayout();
 lTemp.show(this,strKey);
}

public String getFileName() {
 return strFileName;
}

public Color getColor() {
 return new Color(color);
}
public void paintComponent(Graphics tf) {
 super.paintComponent(tf); // VIKTIG!
 
 if (bPicture) {
 	tf.drawImage(II.getImage(), 0, 0,II.getImageObserver());
 	
 } else if (bColor) {
 	tf.setColor(new Color(color));
 	tf.fillRect(0, 0, getWidth(), getHeight());
 }
}
}

public class frmMain {
public static void main(String[] args) {
 //Set up the database connection
 QueryInfo QI = new QueryInfo();
 Query Q = new Query(QI);
 Form frm = new Form("Test EKB", 1024,768);
 PaneMiddag cMiddag = new PaneMiddag(frm, QI);
 PaneWelcome cMain = new PaneWelcome(frm,QI,Q, cMiddag);
 PaneDesert cDesert = new PaneDesert(frm);
 PaneSnacks cSnacks = new PaneSnacks(frm);
 PaneOppskrift cOppskrift = new PaneOppskrift(frm);

 Bakgrunn BG = frm.getBakgrunn();
 
 BG.addControll(cMain, "main");
 BG.addControll(cMiddag, "middag");
 BG.addControll(cDesert, "desert");
 BG.addControll(cSnacks, "snacks");
 
}
}
class StorKnapp extends JPanel {
private String strCaption;
private ImageIcon IIn = new ImageIcon("Stor knapp.png");
private ImageIcon IIp = new ImageIcon("Stor knapp_p.png");
private Font f = new Font("Monospaced", Font.BOLD, 18);
private boolean bEntered = false;
private CustListener CL;
private String strTag;
 
public StorKnapp(String strCaption, String strTag) {
 this.strCaption = strCaption;
 setOpaque(false);
 setSize(100, 100);
 super.addMouseListener(new Listener());
 this.strTag = strTag;
}
public StorKnapp(String strCaption, String strTag,CustListener CL) {
 this.strCaption = strCaption;
 setOpaque(false);
 setSize(100, 100);
 super.addMouseListener(new Listener());
 this.strTag = strTag;
 this.CL = CL;
}

public void addListener(CustListener CL) {
 this.CL =CL;
}

public void paintComponent(Graphics tf) {
 super.paintComponent(tf);
 if (bEntered) {
 	tf.drawImage(IIp.getImage(), 0, 0,IIp.getImageObserver());
 } else {
 	tf.drawImage(IIn.getImage(), 0, 0,IIn.getImageObserver());
 }
 tf.setFont(f);
 tf.drawString(strCaption, 5, 55);
}	

class Listener implements MouseListener  {  
 public void mouseClicked(MouseEvent e) {
 	CL.action(strTag);
 }
 public void mouseEntered(MouseEvent e) {
 	bEntered = true;
 	repaint();
 }
 public void mouseExited(MouseEvent e) {
 	bEntered = false;
 	repaint();
 }
 public void mousePressed(MouseEvent e) {}
 public void mouseReleased(MouseEvent e) {}
}
}
class LitenKnapp extends JPanel {
private String strCaption;
private ImageIcon[] II = {new ImageIcon("knapp.png"),new ImageIcon("knapp_p.png"),new ImageIcon("knapp_b.png")};
private Font f = new Font("Impact", Font.BOLD, 18);
private boolean bEntered = false;
private CustListener CL;
private String strTag;
private boolean bBlink = false;
private boolean bBlink2 = false;
 
public LitenKnapp(String strCaption, String strTag) {
 this.strCaption = strCaption;
 setOpaque(false);
 setSize(150, 30);
 super.addMouseListener(new Listener());
 this.strTag = strTag;
 
 new Timer(500, new TimerClass()).start();
}

public LitenKnapp(String strCaption, String strTag, CustListener CL) {
 this.strCaption = strCaption;
 setOpaque(false);
 setSize(150, 30);
 super.addMouseListener(new Listener());
 this.strTag = strTag;
 this.CL = CL;
 
 new Timer(750, new TimerClass()).start();
}

public void addListener(CustListener CL) {
 this.CL =CL;
}

public boolean getBlink() {return bBlink;}
public void setBlink(boolean bBlink) {
 this.bBlink = bBlink;
 bBlink2 = false;
 repaint();
}

public void paintComponent(Graphics tf) {
 super.paintComponent(tf);
 int i = 0;
 if (bEntered) {
 	i = 1;
 } else {
 	i = 0;
 }
 tf.drawImage(II[i].getImage(), 0, 0,null);
 tf.setFont(f);
 
 if (bBlink2) {
 	tf.drawImage(II[2].getImage(), 0, 0,null);
 }
 
 tf.drawString(strCaption, 15, 20);
}	
 
class TimerClass implements ActionListener {
 public void actionPerformed(ActionEvent e) {
 	if (bBlink) {
   bBlink2 = !bBlink2;
   repaint();
 	}
 }
}

class Listener implements MouseListener  {  
 public void mouseClicked(MouseEvent e) {
 	CL.action(strTag);
 }
 public void mouseEntered(MouseEvent e) {
 	bEntered = true;
 	repaint();
 }
 public void mouseExited(MouseEvent e) {
 	bEntered = false;
 	repaint();
 }
 public void mousePressed(MouseEvent e) {}
 public void mouseReleased(MouseEvent e) {}
}
}
class ExitButton extends JButton {  
public ExitButton () {
 setSize(55,30);
 setText("Exit");
 setLocation(1024 - 55 - 5,768 - 30 - 5);
 addActionListener(new Listener() );
}

class Listener implements ActionListener  {
 public void actionPerformed(ActionEvent h) {
 	System.exit(0);
 }
}
}

class PaneWelcome extends JPanel{
private Form frm;
private QueryInfo QI;
private Query Q;
private PaneMiddag PM;
 
public PaneWelcome (Form frm,QueryInfo QI, Query Q, PaneMiddag PM) {
 this.frm = frm;
 setOpaque(false);
 initControlls();
 setLayout(null);
 this.QI = QI;
 this.Q = Q;
 this.PM = PM;
}

public Component add(Component controll,int x,int y,int width,int height) {
 controll.setSize(width, height);
 controll.setLocation(x,y);
 return super.add(controll);
}
 
public void initControlls() {
 JButton cmdSnacks = new JButton("Snacks");
 JButton cmdMiddag = new JButton("Middag");
 JButton cmdDesert = new JButton("Desert");
 
 //cmdSnacks.setEnabled(false);
 
 cmdSnacks.addActionListener(new cmdListener());
 cmdMiddag.addActionListener(new cmdListener());
 cmdDesert.addActionListener(new cmdListener());
 //test
 add(cmdSnacks,102,90,175,69);
 add(cmdMiddag,282,90,175,69);
 add(cmdDesert,462,90,175,69);
 
 add(new Bakgrunn(Color.green), 727,90,200,69); //Prix Logo
 add(new Bakgrunn(Color.yellow), 727,315,200,358); //EKB Logo
 
 JTextArea tekst = new JTextArea("Her kommer en tekst\nDet gronne arealet er lagt til for Prix sin logo, \nog det gule arealet er designet for og bruke EKB logo'en...\n\nUtenom det sa fungerer ingen ting utenom Exit knappen\n(Som ikke skal vere der nar prosjektet er ferdig...) \n\nDenne demoen er kunn for og se \nhvordan forsiden skal se ut, og for og vise at\nnow _fakstisk_ skjer med prosjektet;)");
 //tekst.setVerticalAlignment(JLabel.TOP);
 tekst.setSize(388,358);
 tekst.setOpaque(false);
 tekst.setFont(new Font("Monospaced", Font.BOLD, 18));
 
 add(tekst, 102,315,535,358);
 add(new ExitButton());
}

class cmdListener implements ActionListener {
 public void actionPerformed(ActionEvent hendelse) {
 	String cmd = hendelse.getActionCommand();
 	
 	if ( cmd.compareTo("Snacks")==0) {
   //Snacks
   frm.getBakgrunn().setCurrent("snacks");
   QI.setType(QI.SNACKS);
 	} else if (cmd.compareTo("Middag")==0) {
   //Middag
   frm.getBakgrunn().setCurrent("middag");
   QI.setType(QI.MIDDAG);    
   PM.updateKnapper();
 	} else if  ( cmd.compareTo("Desert")==0) {
   //Desert
   frm.getBakgrunn().setCurrent("desert");
   QI.setType(QI.DESERT);
 	}
 }
}
}

class PaneMiddag extends JPanel{
private Form frm;
private QueryInfo QI = null;
private CustListener2 CL = new CustListener2();
 
public LitenKnapp cmdFisk = new LitenKnapp("Fisk", "fisk", CL);
public LitenKnapp cmdKjott = new LitenKnapp("Kjott", "kjott", CL);
public LitenKnapp cmdFugl = new LitenKnapp("Fugl", "fugl", CL);
public LitenKnapp cmdVegetar = new LitenKnapp("Vegetar", "vegetar", CL);
public LitenKnapp cmdHurtig = new LitenKnapp("Hurtigmat", "hurtig", CL);
public CustList lstMain = new CustList(CL, "list");
public KnappEnkel cmdOpp = new KnappEnkel(false, "opp",CL);
public KnappEnkel cmdNed = new KnappEnkel(true, "ned",CL);
public KnappDobbel cmdTop = new KnappDobbel(false, "top",CL);
public KnappDobbel cmdBottom = new KnappDobbel(true, "bottom",CL);
public StorKnapp cmdBack = new StorKnapp("Tilbake", "back", CL);
 
public PaneMiddag (Form frm,QueryInfo QI) {
 this.frm = frm;
 setLayout(null);
 setOpaque(false);
 initControlls();
 setSize(1024,768);
 this.QI = QI;
}

public void initControlls() {
 int i = 40;
 add(new Bakgrunn(Color.green),172 ,i,200,69); //Prix Logo
 add(cmdBack, 800,640);
 i+=69;
 i+=20;
 
 //leg til middags labelen..
 Bakgrunn picMiddag = new Bakgrunn("middag.png");
 add(picMiddag, 172,i, 200,35);
 i+= 35;
 i+= 15;
 
 //legg til under menyene...
 add(cmdFisk, 222,i,150,30);
 i+=40;
 add(cmdKjott, 222,i,150,30);
 i+=40;
 add(cmdFugl, 222,i,150,30);
 i+=40;
 add(cmdVegetar, 222,i,150,30);
 i+=40;
 add(cmdHurtig, 222,i,150,30);
 
 //test data
 String[] data = {"testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing","Testing"};
 //end test Data
 
 //Legg til  data..k
 add(lstMain, 412,40);
 lstMain.setListData(data);
 
 //legg til listbox-menyen, 4 knapper
 i = 40;
 int x = 918;
 int y = 926;
 add(cmdOpp, y, i);
 i += 50;
 i+= 20;
 add(cmdTop, x, i);
 i += 50;
 i+= 20;
 add(cmdBottom, x, i);
 i += 65;
 i+= 20;
 add(cmdNed, y, i);
 
 //Disable di
 cmdOpp.setGray(true);
 cmdTop.setGray(true);
 cmdNed.setGray(true);
 cmdBottom.setGray(true);
 
 //updateknappene...
 updateKnapper();
 
 
 //testing
 
}

public boolean isFirstVisible() {
 if (lstMain.getFirstVisibleIndex() == 0) return true;
 if (lstMain.getFirstVisibleIndex() == -1) return false;
 return false;
}
public boolean isLastVisible() {
 if (lstMain.getLastVisibleIndex() == lstMain.getCount() - 1) {
 	return false;
 }
 
 if (lstMain.getLastVisibleIndex() == -1) {
 	return false;
 }
 
 if (lstMain.getLastVisibleIndex() < lstMain.getCount() - 1) {
 	return true;
 }
 return false;
}

public void updateKnapper() {
 boolean bUp = false;
 boolean bDown = false;
 if (isFirstVisible())  {
 	bUp = true;
 	bUp = true;
 } else if (lstMain.getFirstVisibleIndex() == -1) {
 	bUp = true;
 	bUp = true;
 } else {
 	bUp = false;
 	bUp = false;
 }
 if (!isLastVisible()) {
 	bDown = true;
 	bDown = true;
 } else {
 	bDown = false;
 	bDown = false;
 }
 
 cmdOpp.setGray(bUp);
 cmdTop.setGray(bUp);
 
 cmdNed.setGray(bDown);
 cmdBottom.setGray(bDown);
 repaint();
}

public Component add(Component controll,int x,int y) {
 controll.setLocation(x,y);
 return super.add(controll);
}
public Component add(Component controll,int x,int y,int width,int height) {
 controll.setSize(width, height);
 controll.setLocation(x,y);
 return super.add(controll);
}
 
public void paintComponent(Graphics tf) {}
public void clearBlink() {
 cmdFisk.setBlink(false);
 cmdKjott.setBlink(false);
 cmdFugl.setBlink(false);
 cmdVegetar.setBlink(false);
 cmdHurtig.setBlink(false);
}
class CustListener2 extends CustListener {
 public void action(String strTag) {
 	if (compare(strTag, "fisk")) {
   QI.setUnder(QI.FISK);
   clearBlink();
   cmdFisk.setBlink(true);
 	} else if (compare(strTag, "kjott") ){
   QI.setUnder(QI.KJOTT);
   clearBlink();
   cmdKjott.setBlink(true);
 	} else if (compare(strTag, "fugl")) {
   QI.setUnder(QI.FUGL);
   clearBlink();
   cmdFugl.setBlink(true);
 	} else if (compare(strTag, "vegetar")) {
   QI.setUnder(QI.VEGETAR);
   clearBlink();
   cmdVegetar.setBlink(true);
 	} else if (compare(strTag, "hurtig")) {
   QI.setUnder(QI.HURTIG);
   clearBlink();
   cmdHurtig.setBlink(true);
 	} else if (compare(strTag, "back")) {
   frm.setCurrent("main");
 	} else if (compare(strTag, "top")) {
   lstMain.ensureIndexIsVisible(0);
 	} else if (compare(strTag, "opp")) {
   lstMain.ensureIndexIsVisible(lstMain.getFirstVisibleIndex() - 1);
 	} else if (compare(strTag, "ned")) {
   lstMain.ensureIndexIsVisible(lstMain.getLastVisibleIndex() + 1);
 	} else if (compare(strTag, "bottom")) {
   lstMain.ensureIndexIsVisible((int)lstMain.getCount() - 1);
 	} 
 	updateKnapper();
 }
}

public boolean compare(String str1, String str2) {
 if (str1.compareTo(str2) == 0) return true;
 return false;
}
}

class PaneSnacks extends JPanel{
private Form frm;
public PaneSnacks (Form frm) {
 this.frm = frm;
 setOpaque(false);
 initControlls();
 setLayout(null);
}

public void initControlls() {
 Listener L = new Listener();
 StorKnapp ST = new StorKnapp("Start","back");
 ST.setLocation(5,5);
 ST.addListener(new Listener());
 add(ST);
 
 KnappEnkel ST2 = new KnappEnkel(true,"down");
 KnappDobbel ST3 = new KnappDobbel(false, "dubbleup");
 LitenKnapp ST4 = new LitenKnapp("Snacks", "back");
 ST2.setLocation(500,200);
 ST3.setLocation(600,200);
 ST4.setLocation(700,200);
 ST4.addListener(L);
 ST.addListener(L);
 ST2.addListener(L);
 ST3.addListener(L);
 add(ST2);
 add(ST3);
 add(ST4);
}

class Listener extends CustListener {
 public void action(String strTag) {
 	System.out.println(strTag);
 	if (strTag.compareTo("back") == 0) {
   	frm.setCurrent("main");
 	} else if (strTag.compareTo("up") == 0) {
 	} else if (strTag.compareTo("dubbleup") == 0) {
 	} else if (strTag.compareTo("dubbledown") == 0) {
 	} else if (strTag.compareTo("down") == 0) {
 	}
 }
}
}

class PaneDesert extends JPanel{
private Form frm;
public PaneDesert (Form frm) {
 this.frm = frm;
 setOpaque(false);
 initControlls();
}

public void initControlls() {
}
}

class PaneOppskrift extends JPanel{
private Form frm;
public PaneOppskrift (Form frm) {
 this.frm = frm;
 setOpaque(false);
 initControlls();
}

public void initControlls() {
}
}

class KnappEnkel extends JPanel {
private ImageIcon [] II = {new ImageIcon("knappopp.png"), new ImageIcon("knappopp_p.png"), new ImageIcon("knappopp_p_g.png"), new ImageIcon("knappopp_g.png")};
private boolean bEntered = false;
private CustListener CL;
private boolean bDown = false;
private String strTag;
private boolean bGray = false;
 
public KnappEnkel(boolean bDown,String strTag) {
 setOpaque(false);
 setSize(50, 50);
 addMouseListener(new Listener());
 this.bDown = bDown;
 this.strTag = strTag;
}
public KnappEnkel(boolean bDown,String strTag,CustListener CL) {
 setOpaque(false);
 setSize(50, 50);
 addMouseListener(new Listener());
 this.bDown = bDown;
 this.strTag = strTag;
 this.CL = CL;
}

public void setGray(boolean bGray) {
 this.bGray = bGray;
}

public void paintComponent(Graphics g) {
 super.paintComponent(g);	
 int i = 0;
 
 if (bGray) {
 	if (bEntered) {
   i = 2;
 	} else {
   i=3;
 	}
 } else {
 	if (bEntered) {
   i=1;
 	} else {
   i=0;
 	}
 }
 
 //rotering av bilde...
 if (bDown) {
 	Graphics2D g2d = (Graphics2D) g;
 	g2d.rotate(Math.toRadians(180), 25, 25);	
 	g2d.drawImage(II[i].getImage(), 0, 0,null);	
 } else {
 	g.drawImage(II[i].getImage(), 0, 0,null);
 }
}

public void addListener(CustListener CL) {
 this.CL =CL;
}

class Listener implements MouseListener  {
 public void mouseClicked(MouseEvent e) {
 	if (!bGray) CL.action(strTag);
 }
 public void mouseEntered(MouseEvent e) {
 	bEntered = true;
 	repaint();
 }
 public void mouseExited(MouseEvent e) {
 	bEntered = false;
 	repaint();
 }
 public void mousePressed(MouseEvent e) {}
 public void mouseReleased(MouseEvent e) {}
}
}


class KnappDobbel extends JPanel {
private ImageIcon [] II = {new ImageIcon("knappoppdbl.png"), new ImageIcon("knappoppdbl_p.png"), new ImageIcon("knappoppdbl_p_g.png"), new ImageIcon("knappoppdbl_g.png")};
private boolean bEntered = false;
private CustListener CL;
private boolean bDown = false;
private String strTag;
private boolean bGray = false;
 
public KnappDobbel(boolean bDown, String strTag) {
 setOpaque(false);
 setSize(66, 65);
 addMouseListener(new Listener());
 this.strTag = strTag;
 this.bDown = bDown;
}
public KnappDobbel(boolean bDown, String strTag,CustListener CL) {
 setOpaque(false);
 setSize(66, 65);
 addMouseListener(new Listener());
 this.strTag = strTag;
 this.bDown = bDown;
 this.CL = CL;
}

public void setGray(boolean bGray) {
 this.bGray = bGray;
}

public void addListener(CustListener CL) {
 this.CL =CL;
}

public void paintComponent(Graphics g) {
 super.paintComponent(g);	
 int i = 0;
 
 if (bGray) {
 	if (bEntered) {
   i = 2;
 	} else {
   i=3;
 	}
 } else {
 	if (bEntered) {
   i=1;
 	} else {
   i=0;
 	}
 }
 
 //rotering av bilde...
 if (bDown) {
 	Graphics2D g2d = (Graphics2D) g;
 	g2d.rotate(Math.toRadians(180),33,32);	
 	g2d.drawImage(II[i].getImage(), 0, 0,null);	
 } else {
 	g.drawImage(II[i].getImage(), 0, 0,null);
 }
}

class Listener implements MouseListener  {
 public void mouseClicked(MouseEvent e) {
 	if (!bGray) CL.action(strTag);
 }
 public void mouseEntered(MouseEvent e) {
 	bEntered = true;
 	repaint();
 }
 public void mouseExited(MouseEvent e) {
 	bEntered = false;
 	repaint();
 }
 public void mousePressed(MouseEvent e) {}
 public void mouseReleased(MouseEvent e) {}
}
}

class CustListener {
public void action(String strTag) {}
}
class CustList extends JPanel {
private CustListener CL = null;
private String strTag;
private JList lst = new JList();
private JScrollPane pane = new JScrollPane(lst);
Font fl = new Font("Times New Roman", Font.PLAIN, 32);
 
public CustList(CustListener CL, String strTag) {
 this.CL = CL;
 this.strTag = strTag;
 init();
}
public CustList(CustListener CL, String strTag, String[] data) {
 this.CL = CL;
 this.strTag = strTag;
 lst.setListData(data);
 init();
}
private void init() {
 setLayout(null);
 pane.setSize(486,500);
 setSize(486,560);
 add(pane);
 
 pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
 pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
 pane.setViewportBorder(null);
 pane.setSize(486,560);
 lst.setFont(fl);
}
public int getFirstVisibleIndex() {
 return lst.getFirstVisibleIndex();
}
public int getLastVisibleIndex() {
 return lst.getLastVisibleIndex();
}
public int getVisibleRowCount() {
 return lst.getVisibleRowCount();
}
public void setListData(Object[] data) {
 lst.setListData(data);
}
public void ensureIndexIsVisible(int Index) {
 lst.ensureIndexIsVisible(Index);
}

public int getCount() {
 return lst.getModel().getSize();
}
}

 

og her er den kompilerte versjon(se vedlegg( brukte -source 1.4 argumentet...))

[EDIT-Fjernet]

 

Er det muligt at noen andre kan teste programmet pa Linux og MacOSX... ?

 

Paa forhand takk

 

[EDIT] fjernet linken til binaer filene..

Endret av Richard87
Lenke til kommentar
Videoannonse
Annonse
antar bildet ditt heter "middag.png" og ikke "Middag.png" eller en annen kombinasjon av små/store-bokstaver.

 

altså siden du i koden skriver bildenavnet med små bokstaver?

 

(vet ikke om dette var til så mye hjelp, men)

5995159[/snapback]

 

Temmelig sikker på at du fant feilen der ja, siden det heter "Middag.png" i arkivet han har lagt ved her...

 

Til trådstarter, det kan være greit å bruke samme formatering på filnavn, slik at man unngår forvirring når filene skal lastes inn. (Pluss at det fjerner problemet du har nå med at et fil-system ikke skiller mellom stor og små bokstaver, og et annet skiller mellom dem)

 

PS. det er hyggelig hvis du omformatere teksten i JTextArea slik at vi slipper å få strukket vinduet så utrolig mye...

Endret av Mr.Garibaldi
Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...