Solved

help with setting up a swing components

Posted on 2006-07-23
7
196 Views
Last Modified: 2010-03-31

hello there,

i want to develop a panel in which i will fill it with JButtons.the number of buttons will depend on the number of data in the db.i want to know how can i get started with this thing.

please help

cheers
zolf
0
Comment
Question by:zolf
  • 5
  • 2
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17162584
Just create a List of JButton. Add to it as you retrieve results
0
 

Author Comment

by:zolf
ID: 17162588

can you give me some code example please.
do i need to use something like this

Panel pKey = new Panel();
pKey.setLayout(new GridLayout());
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17162592
Yes, you can. If you do that after retrieval, you can determine the rows and columns too
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 17162600
Actually to avoid two iterations, you can call setColumns on the GridLayout, having retrieved the number of columns from DatabaseMetaData
0
 

Author Comment

by:zolf
ID: 17162608

how do i add the data to the JButton and then add the button on the panel??
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17162614
>>how do i add the data to the JButton

You need to tell me more about what's required. You probably need to do

JButton b = new JButton(rs.getString("SomeColumn"));
buttons.add(b); // add to List
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17162622
:-)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now