Ruben1123's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
16 (0.02 per day)
Joined:
19-May 12
Profile Views:
837
Last Active:
User is offline Oct 03 2012 08:32 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Ruben1123 has not set their status

Posts I've Made

  1. In Topic: Creating an updater in Java

    Posted 25 Jun 2012

    This was great, thanks.
  2. In Topic: From basic JTable to a JTable with a TableModel

    Posted 29 May 2012

    Never mind, just needed a scroll pane.
  3. In Topic: Basic text based game

    Posted 28 May 2012

    So you want to return the new location? Why not have it return an int[2] array with int[0] = x and int[1] = y?
  4. In Topic: From basic JTable to a JTable with a TableModel

    Posted 27 May 2012

    This tutorial worked wonders, but I can't get the header to show up. I have made very few modifications only changing the variable names on the add method and modifying the constructor.

    
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    
    public class MyModel extends AbstractTableModel {
    
    	private ArrayList<Object[]> al;
    	private String[] header = {"Course", "Grade"};
    
    	public MyModel() {
    		al = new ArrayList<Object[]>();
    	}
    
    
    	public int getRowCount() {
    		return al.size();
    	}
    
    	public int getColumnCount() {
    		return header.length;
    	}
    
    	public Object getValueAt(int rowIndex, int columnIndex) {
    		return al.get(rowIndex)[columnIndex];
    	}
    
    	public String getColumnName(int index) {
    		return header[index];
    	}
    
    	public void add(String course, String grade) {
    		String[] str = new String[2];
    		str[0] = course;
    		str[1] = grade;
    		al.add(str);
    		fireTableDataChanged();
    	}
    }
    
    


    Then in my driver I have a simple:
    JTable table = new JTable(new MyModel());
    		table.setBounds(25, 25, 615, 300);
    		Grades.add(table); //panel
    
    
  5. In Topic: When is a JComboBox Initialized?

    Posted 26 May 2012

    Yes, it worked!

    That's why I've come here*

    Sorry, not enough posts to edit yet.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Ruben1123 hasn't added any friends yet.

Comments

Ruben1123 has no profile comments yet. Why not say hello?