Search:

Type: Posts; User: Cornix

Page 1 of 20 1 2 3 4

Search: Search took 0.51 seconds.

  1. Thread: Swing library

    by Cornix
    Replies
    2
    Views
    105

    Re: Swing library

    Swing is old but it can still be used. I would go as far as saying that it is the most used GUI library for java, although I have no numbers to back my statement up.
    However a new GUI library is...
  2. Replies
    3
    Views
    100

    Re: how do i add images to my program..?

    Another problem is that you are calling repaint() inside the paintComponent(Graphics) method. This is a really bad idea, dont do it.
  3. Replies
    3
    Views
    124

    [SOLVED] Re: Different Classes

    Might it be that a Get-method is what you are looking for?
    One object will create a second object. The creation of an object is done using a constructor. You can pass arguments to a constructor and...
  4. Replies
    4
    Views
    140

    Re: whats wrong with my sprite code?

    If you implemented a class correctly and you are using it correctly then it will do the correct thing.
    If it doesnt do the correct thing you either:
    1) Didnt implement the class correctly
    or
    2)...
  5. Re: what argument exactly is being sent to the eventlistner() methods?

    If you call an addXxxListener(...) method with an object reference the only thing that is important is that the object in question implements the interface for the listener that it is supposed to be...
  6. Thread: Observer (MVC)

    by Cornix
    Replies
    4
    Views
    84

    Re: Observer (MVC)

    The "Listeners" in Swing (ActionListener, ItemListener, etc) are observers. They are just being called listeners because the people who designed the Swing API preferred that name. In the end, it...
  7. Replies
    5
    Views
    121

    Re: Pokemon Revolution

    And your question is?
  8. Replies
    5
    Views
    121

    Re: Pokemon Revolution

    So, what do you need help with? What have you got so far?

    Ask a specific question about a programming problem.
  9. Re: What is different between argument and perameter ?

    Parameters are what is defined in the code, arguments are the explicit values that your program is being passed at runtime.
  10. Re: variable i was intialized but code thinks it wasn't

    Initializing a variable is giving it its first value. For example:

    int i = 5;
    This code is defining and initializing the variable i.
  11. Re: variable i was intialized but code thinks it wasn't

    Because it isnt.
    Where is it initialized? Can you show us the line?
    I can only see that it is defined, but never initialized.
  12. Replies
    26
    Views
    385

    Re: Show image in second window

    My example program was meant to show you how easy it can be to have the same image shown in two JFrames.
    Just try to replicate the code as good as possible without breaking your design.

    You will...
  13. Replies
    26
    Views
    385

    Re: Show image in second window

    Look at this very simple example program. It creates 2 frames, loads a BufferedImage from a file and displays the same image in both created frames.
    import java.awt.Dimension;
    import...
  14. Replies
    7
    Views
    145

    Re: Throwing your own Exception help.

    The nextInt method will throw an InputMismatchException if you enter anything other then an integer. You would have to catch this exception if you want to throw your own exception instead.

    If you...
  15. Re: How to store file properties in a File for a Notepad. Thinking of using serialization.

    Serialization works by reading all fields of the object that are not declared transient and then doing some magic in the background to convert them to byte code. The resulting mix of byte code,...
  16. Re: Java - Reading from a Socket using a BufferedReader object

    Read the API for the InputStream class. There is defined that any InputStream will block when attempting to read from it.
    https://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html#read%28%29
  17. Re: Java - Reading from a Socket using a BufferedReader object

    Nothing. The call will block on the socket and the program will stop until another message is received.
  18. Re: Java - Reading from a Socket using a BufferedReader object

    Did you also read this part that I have linked:

    So you will read a line once a newline or carriage return character has been read.
    If the socket is closed it will count as an EndOfFile.
  19. Re: Java organisational chart - import text file and print management chain?

    Here is a very minimalistic example of how you could build a Tree in java:
    import java.util.ArrayList;
    import java.util.List;

    public class TreeNode {

    public static void main(String[] args)...
  20. Re: Java organisational chart - import text file and print management chain?

    A tree can easily be build from a single Node class that has a reference to its parent (a Node) and a List of children which are also nodes.
  21. Re: Java - Reading from a Socket using a BufferedReader object

    Did you read the documentation for the BufferedReader class?
    If not that should be your first stop:
  22. Re: JFrame where only three of the borders and no content appear

    Do you run your Swing GUI on the Event-Dispatcher Thread?
    If you dont then that would be the first thing you should read up on.
  23. Replies
    7
    Views
    145

    Re: Throwing your own Exception help.

    Your methods do not make much sense to me. You throw your exception every time, although that might work in practice it is bad coding style and frowned upon. An exception should be thrown in an...
  24. Replies
    4
    Views
    170

    Re: use of Generics in map reduce program

    I wouldnt say its a silly question, but its very vague. Do you have problems with generic classes in general or is it just this one example that you are having a problem with?
    I do not know for sure...
  25. Re: Sample example code of a thread programmed to retry in the event an action fails

    You can not start a thread more then once. When you run a thread and an Exception is thrown (or the thread is stopped naturally) then its gone.
    The only thing you can do is create a new Thread to...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4