How did you get the block from the beginning?
Type: Posts; User: sebbe605
How did you get the block from the beginning?
Im not sure what your trying to do. please elaborate.
Also use code block when posting code, see FAQ!
It's
System.out.print("-");
Put some breakpoints out and follow whats happens and im sure youll get a clearer picture of what's happening.
--- Update ---
Neither do i. I was looking at another thread there someone had similar problems. They ended up changing the ArrayList to List
List<Media> mediaList = (List<Media>) inStream.readObject(); but he...
Couldn't get it to work so i went with another method.
public void saveOnFile() {
File file = new File("data.txt");
try {
if(!file.createNewFile()) {
file.createNewFile();
Okay, i changed some stuff around and i think that this should work, but it doesn't work.
public void readFromFile() {
try {
ObjectInputStream inStream = new...
This warning: Type safety: Unchecked cast from Object to ArrayList<Media>
I tried with this earlier:
public void readFromFile() {
try {
ObjectInputStream inStream = new ObjectInputStream(new FileInputStream("object.txt"));
this.mediaList.addAll(...
Hello,
i have saved an arrayList to file using the ObjectOutputStream but now when i try to read the file i get problems.
saveOnFile:
public void saveOnFile() {
try {...
Icon returnString = ((JLabel) mediaPanel.getComponentAt(arg0.getX(), arg0.getY())).getIcon();
System.out.println(returnString);
I did this and it works.
Im trying to get the defaultIcon from getComponentAt()
mediaPanel.getComponentAt(arg0.getX(), arg0.getY())
And i get the putput:
Okay, this is a tricky one. I tried to rebuild the shelf's by simply calling:
private void addComponents() {
JPanel shelfs = buildShelfs();
this.add(shelfs);
}
And this as far as i...
It goes back to the function i call:
public void repaintWindow() {
this.getContentPane().validate();
this.getContentPane().repaint();
}
I'm not sure if i can call the repaint. I...
Errors you say:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at project.MediaHandler.addMovie(MediaHandler.java:19)
at...
Hi, as the topic follows im trying to repaint a window from another class. the class Window handles an interface that displays pictures of movies. Via a JMenuBar you can add a new movie and its...
It turned out to be an error with the size(); from the ArrayList. Ones i fixed that and changed return null; to return mediaPanel; it worked the way i wanted.
Hello, i'm having this where i'm trying to return a JPanel with tempPictures but only if they aren't already filled with "actual" pictures. However this causes problems because your never shore that...
I ended up going with this method:
double playTime = Double.parseDouble(this.title.getText());
I think this will work somewhat good tho ill need to cast some error statements in order for...
Hello,
I'm working with a project there ill need to enter some values for an Object and for this i'm using JTextField. However some of the variables are of the types double, int and bool. Is there...
This: "It only took 50 hours to solve it"
MediaHandler myReg = new MediaHandler();
Is it really a good idea to have a register set as static? I mean i'm going to be adding several medias to...
If i declare and ArrayList as follows "public static ArrayList<Media> mediaList = new ArrayList<Media>();" How can i access it in another class (main class)?
package Projekt;
import...
Anyhow i put it in a package now and it works, thanks for the help. Im not used to java or Eclipse and the only experience i have is with c++ so its a learning path for me.
In the project im working in i dont have any packages included, the classes lay under the (default package). and in the MVCE i did import thiistest.one.number; got included which i tried including in...
Super:
package thiistest;
public abstract class one {
public enum number{one,two}
private number myNumber;
public one(number myNumber) {
Hi, im having some problems with adding an enum value to an object in an arraylist.
I've highlighted the part that i can't get to work: rating.five (could not highlight the codesnip)
...