Ruel Soriano

+ Follow
since May 17, 2007
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ruel Soriano

can someone give sample that has a checkbox in every node. I made JTree format of data from database, problem is i can't make a checkbox for my JTree, and I explore how to make one its get me more confused. so if someone can show how to make i would appreciate it.
16 years ago
if i can get some code or extract a code just to be my guide......i know how to get the column name from and extract it to jtree but my problem is how if one of my column has a child, automatically it add on the last column name i created.
for example col_1, col_2, col_3 will be the node for root, what if i have a child for for each of the column, all of them will be in the last column like col_3.......

so please give a solution for this.....urgent.
16 years ago
Thanks for the code, it really helped me, your a saver.....
till next time.
Thanks again.
16 years ago
sorry for that, but i could not start what i'm doing coz i dont have any idea and can't of one, well i know how to use ResultSetMetaData and displaying the column but my big problem is how can i make a child of each...for example

Table [table_1] with column [column_1 column_2 column_3]
Table [table_2] with column [col1 col2 col3]

how can i make them to display in JTree like:


could someone give me an idea or better a sample code for this....
thanks in advance.....
16 years ago
greetings, could someone send me simple code on how to get the column names from table and display it in JTree format. I have two table maintenace and report, the node name would be the two table name and its child would be its corresponding column name and child for column would be its value or element....please someone help me for this...
thank you very much.
16 years ago
thanks for the reply, but could you please give me a brief example of that code, i really don't know how to do that.
16 years ago
could someone give me sample code of tree with checkboxes. And how could handle an event to save all the selected checkboxes in a database.......
can someone please send sample....i appreciated it very much.
16 years ago
Thanks for the reply.....but I have something to add, I want my selected value from the table will be display to another class. For example, class Table and Class Main....when i click button Find in the Main class the table from Table Class will be display and when I select value from the table and click the button Select the selected value will display to the Textfield of Main Class. How can i get it.
Many thanks and I hope you could help me again.......
16 years ago
can someone look and check my codes and tell me why it didn't work when i choose Minimize, Maximize, Resize and change Title in Menu.....nothing happened if i chose from [Minimize, Maximize, Resize and change Title]any of them, is there something wrong with my actionPerformed...
here are the codes.....

import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class Application {
* Creates an instance of JFrame with certain attribute passed
* as argument.
* @param titleWindow title
* @param dimensionDimension of window
* @return instance of JFrame
protected JFrame createMainFrame(String title, Dimension dimension) {

// create an instance of the window
JFrame frm = new JFrame(title);

// set the size of the window

// move the window to coordinate X:200, and Y:300
frm.setLocation(new Point(200,300));

return frm;
* This section creates a menu bar instance that can be added in an
instance of
* JFrame.
* @return
protected JMenuBar createMainMenu() {
// create the main menu bar
JMenuBar menuBar = new JMenuBar();

// create a menu holder
JMenu fileMenu = new JMenu("File");

// this change the font of the menu item
fileMenu.setFont(new Font("Tahoma", Font.PLAIN, 12));

// add the menu holder to the main menu

// to create a menu item that will hava an action use JMenuItem
JMenuItem newMenu = new JMenuItem("New...");
newMenu.setFont(new Font("Tahoma", Font.PLAIN, 12));
// add item to filemenu

* Adding sub menus, to add sub menus you add an instance of JMenu
* within JMenu
JMenu recentFiles = new JMenu("Recent Files");
// you dont need tochagne the font every time, i just want to use tahoma
recentFiles.setFont(new Font("Tahoma", Font.PLAIN, 12));
//add to file menu

// then add JMenuItem in the newly create JMenu
JMenuItem item1 = new JMenuItem("File 1");
JMenuItem item2 = new JMenuItem("File 2");
JMenuItem item3 = new JMenuItem("File 3");

//adding a separator

// adding exit menu item under file menu after the separator
JMenuItem exitMenu = new JMenuItem("Exit");
exitMenu.setFont(new Font("Tahoma", Font.PLAIN, 12));
// add item to filemenu

* associating an action to a menu; there are different ways to do
this but this is
* the simplest form; use the method addActionlistener()
* 1: create an instance of ActionListener; however ActionListener is
an interface,
* the only way you can create an instance is to implement it, this
is an inline
* implementation
ActionListener exitAction = new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// this will be called if the menu is clicked
// exit the application

* 2: associate to a menu item (the exit menu item)

// to add another menu with the same level of File menu, you need to add another
// JMenu in the instance of JMenuBar

JMenu windowMenu = new JMenu("Window");

//adding subMenu for windowMenu
JMenuItem minimizeMenu = new JMenuItem("Minimize");
ActionListener minimizeAction = new ActionListener(){
public void actionPerformed(ActionEvent args){
JFrame frame = new JFrame();

JMenuItem maximizeMenu = new JMenuItem("Maximize");
ActionListener maximizeAction = new ActionListener(){
public void actionPerformed(ActionEvent args){
JFrame frame = new JFrame();


JMenuItem resizeMenu = new JMenuItem("Resize to 500,500");
ActionListener resizeAction = new ActionListener(){
public void actionPerformed(ActionEvent args){
new Application().createMainFrame("Example Application",new Dimension(500,400));

JMenuItem changetitleMenu = new JMenuItem("title to Welcome");
ActionListener changetitleAction = new ActionListener(){
public void actionPerformed(ActionEvent args){
new Application().createMainFrame("Welcome", new Dimension(500,400));
// each JMenuBar, JMenu, JMenuItem are treated as individual instance or objects
// they are registed to each other on how you issue the add command call

return menuBar;

* Use to create and start the frame
public void start() {
// create main window
JFrame frame = createMainFrame("Example Application", new Dimension(500,400));

// add main menu, and create children

// show the frame, if this is not called, the application will be terminated.
// and now window will be displayed.

* Main executable point, entry point of execution.
* @param args
public static void main(String[] args) {
new Application().start();

16 years ago
in this part i got errors, it says invalid cursor state.....
and these are the codes were i got it....

data.addElement(new Vector());
can someone get me a new code to run this program...
I would appreciate it very much......
how can i get value from JTable and set it to textfield. I have to classes, one for JTable class and other for Textfield class, how can i get the value when i select value from JTable class and put it on textfield which is another class.....
i really need this, please help me.....
16 years ago
check this code:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import java.sql.*;
import java.util.*;
import javax.swing.JScrollPane;
import javax.swing.border.*;

public class TestingAgain extends JFrame{
Connection con;
Vector columnName, data;
JTable myTable;
JScrollPane myPane;
JButton select;

/** Creates a new instance of TestingAgain */
public TestingAgain() {
JPanel panel = new JPanel();
select = new JButton("select");

catch (ClassNotFoundException cnfEx)
con = DriverManager.getConnection("jdbc:odbc:MS Access Database", "", "");
Statement stat = con.createStatement();
ResultSet rs = stat.executeQuery("select group,description from groupcode");

columnName = new Vector();

data = new Vector();
data.addElement(new Vector());
catch (SQLException sqlEx)
JOptionPane.showMessageDialog(null,"Error loading table.\nPlease check setup");
myTable = new JTable(data, columnName);
myPane = new JScrollPane(myTable);
Border etchedBorder = BorderFactory.createEtchedBorder();
Border titleBorder = BorderFactory.createTitledBorder(etchedBorder,"Group Code");

panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS));
public static void main(String[]agrs)
new TestingAgain();

i have a problem getting the data in my JTable it display the JOPtion...i think i have error in the part:
data.addElement(new Vector());
can someone get me a new code to run this program...
I would appreciate it very much......