User Profile

Collapse

Profile Sidebar

Collapse
AlarV
AlarV
Last Activity: Jul 4 '11, 07:13 AM
Joined: Dec 4 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • AlarV
    started a topic JTree Custom Renderer, Tree Nodes not shown properly.
    in Java

    JTree Custom Renderer, Tree Nodes not shown properly.

    Hello everyone!

    I created a custom JTree Renderer for my tree because I wanted it to have an icon near each node.
    Here is a sample of my code for the custom renderer.

    Code:
    public TreeRenderer()  {
        renderer = new JPanel();
        renderer.setLayout(new BoxLayout(renderer, BoxLayout.X_AXIS));
        titleLabel = new JLabel(" ");
        titleLabel.setForeground(Color.black);
        titleLabel.setFont(new
    ...
    See more | Go to post

  • AlarV
    started a topic Override JTree listener?
    in Java

    Override JTree listener?

    Hello everyone!
    I'm stuck with a problem, caused by a mix of listeners in a JTree.

    Here goes:
    I created my own renderer for the tree, that is one JLabel (icon+name), and then another JLabel (let's name it button) that has a small icon. I want the user to be able to click on the "button" JLabel and something to happen.

    e.g.
    Program1 (on)
    Program2 (on)

    assuming (on) is an icon....
    See more | Go to post
    Last edited by Niheel; Mar 12 '11, 05:46 PM.

  • AlarV
    started a topic Splash Screen before program begins
    in Java

    Splash Screen before program begins

    Hey everyone!
    I've been trying to create a Splash Screen in my Java program. I've managed to make the splash screen show itself, with the program. I now want to make it show first, and then show my main program. As in every program nowadays..

    Here is my code:

    Code:
    /*
    
    
    package ****;
    
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.Frame;
    ...
    See more | Go to post

  • sorry for the delay.. you are right! that was the problem I thought that as it was in the class it ran alone, but you have to call it in main.

    Thanx!
    See more | Go to post

    Leave a comment:


  • I can't cause of the classic bull#*$@#* of java.

    initComponents isn't static and I can't call it in static main..

    I tried what you suggested before though.
    treePanel=new JPanel(); before run() and it worked!
    this means that initComponents doesn't run, so I'll have to check this out.

    If you have any ideas why initComponents is not working you are more than welcome to tell them. I'm stuck at this...
    See more | Go to post

    Leave a comment:


  • well the main program has this method
    Code:
    public Main() {
            initComponents();
        }
    and then in initComponents it does all the work I posted. then there is this

    Code:
    public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                
                public void run() {
                    try {
    and that's where I add the panel to the main...
    See more | Go to post

    Leave a comment:


  • yes it's on line 1 in the first code tag!
    See more | Go to post

    Leave a comment:


  • well yeah it says:

    Exception in thread "AWT-EventQueue-0" java.lang.NullP ointerException
    at charybdis.Main$ 2.run(Main.java :260)
    and it is this line
    Code:
    mPanel.add(treePanel);
    See more | Go to post

    Leave a comment:


  • AlarV
    started a topic Java GUI Static component, NullPointerException
    in Java

    Java GUI Static component, NullPointerException

    Hey everyone, I created a GUI project, where I'm using a JTree. When it's created everything is ok, but in my run() method when I call it i get a nullPointerExce ption. Here is the code.
    Code:
    treePanel = new javax.swing.JPanel();
    DefaultMutableTreeNode top =
            new DefaultMutableTreeNode("blah");
            mytree = new javax.swing.JTree(top);
    javax.swing.GroupLayout treePanelLayout = new javax.swing.GroupLayout(treePanel);
    ...
    See more | Go to post
    Last edited by AlarV; Jan 7 '11, 10:11 AM. Reason: additional code

  • JFreeChart create a graph within a Java GUI in a panel?

    Hey everyone,
    I'm trying to create a java project that has some charts and stuff. I'm using JFreeChart cause it's open-source and I'm stuck for like a week with this problem:

    I want to create charts within a java GUI and put wherever I want INSIDE the JFrame. In a panel or something like this. Every tutorial and example I've checked creates a panel,adds the charts in this panel, then creates a frame and sets the content of it...
    See more | Go to post

  • AlarV
    started a topic Create Pop-up window in java NetBeans
    in Java

    Create Pop-up window in java NetBeans

    I'm programming with GUI in Java Netbeans and I want to create a pop-up window that runs at the beginning of my program, asks for the date and reads it from the user. What kind of Container should I use? I want it to be on top of my program, not close until the user clicks the date and OK and until then the user can't click anything else.

    Kind regards,
    Alex
    See more | Go to post

  • Ok thnx everyone for your help, I did what I asked for and after all it was easy :)
    See more | Go to post

    Leave a comment:


  • Thanks for the replies. I checked the databases and as I don't know much about them, I decided to use the .txt method.

    I completed the .in part and now I have to implement the stuff that are printed by the program in the .txt file (outputStream part).

    Question: How do I reach the end of a .txt file to write new stuff in the .txt? I used the outputStream.pr intln("blah") and all I had saved in the .txt were...
    See more | Go to post

    Leave a comment:


  • ok thnx.
    I don't have any clue on how to create a database in java, so I'll try the text file.
    Another question now: What kind of text file should I use? Cause I don't know anything of these, for example a google search gives me "binary text file" etc.
    See more | Go to post

    Leave a comment:


  • Store application data, that can be used when i re-run the application?

    The topic says it all, but I'll also say a few words here:

    I want to run a program many times and keep the data that I inserted every time. For example, if I create a person called Smith, this person should exist in the 2nd,3d,...n time I run the program. How do I do this?


    P.S. I don't need code, I just need the methods, or the libraries that I have to use to do this.

    Thanks in advance!
    See more | Go to post

  • AlarV
    started a topic How do I use an arraylist<object> ?
    in Java

    How do I use an arraylist<object> ?

    I've created a class by using UML, and I have as objects Houses and Owners. I wanted an owner to have more than one houses, so I set navigable association and multiplicity 1...*.

    So in the class an arraylist<house > Houses; has been created. How do I create this array in Main.java?

    I know how to do this with 1 object, e.g.
    Code:
        Owner X=new Owner();
        House myhouse=new House();
        X.setHouses(myhouse);
    ...
    See more | Go to post

  • AlarV
    started a topic Association Problem

    Association Problem

    Hello again everyone!

    I'm creating a project in Java for a university lesson, by using UML Diagrams. To generally give you an idea of the project, I have to create a Property Office, that has as objects Houses,Owners(o f the houses), and a registry that keeps the history of the past and current owners of a house. I'm confused with the associations that I am to create.
    Here is the class diagram:


    1)Is this correct?...
    See more | Go to post
    Last edited by Frinavale; Jan 5 '10, 02:58 PM. Reason: Moved from Java to Software Development

  • Thanx for the replies everyone!
    At last I figured out what to do.. I wanted an array of pointers. So this means class hash **table; and the program works!
    When I call the constructor the table changes and can be used throughout the program.
    See more | Go to post

    Leave a comment:


  • Well it has a private data member that is an array of linked lists, but these lists are also a pointer of class hash. We haven't been taught vectors. I have no idea what it is :(

    Is there another way to do it?
    See more | Go to post

    Leave a comment:


  • AlarV
    started a topic How do I have access to private variables in classes?
    in C

    How do I have access to private variables in classes?

    I want to create an array of pointers, for my class. Each pointer will in fact be the 'head' of a dynamic list. I don't know the size of the array and it has to be given by the user.

    So my problem is that in my class I have to read the size in the constructor. In the other functions of the class( e.g. insert etc.) the table has to EXIST. However, when I try to access it from the other functions (e.g. insert) the table isn't NULL....
    See more | Go to post
No activity results to display
Show More
Working...