• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

JTable JProgressBar

 
Rancher
Posts: 4504
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you had asked Google how to show a button in a JTable you would get this link:
https://stackoverflow.com/questions/13833688/adding-jbutton-to-jtable
 
Ranch Hand
Posts: 230
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator






I give you all the code and I will take a look at your link, it seems to me that I have already seen it
 
Norm Radder
Rancher
Posts: 4504
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you explain what problems you are having with all that  code that you just posted?
 
ronald deux
Ranch Hand
Posts: 230
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the buttons are not displayed in the ButtonNumber column depending on the files I have in my directory
for example if I have 5 files in my directory automatically 5 buttons numbered from 1 to 5 are displayed
I'm not trying to manually write the number of buttons in an array, it's done automatically depending on the number of files in the directory of course I think we need an array
I think an array of string is better than an array of int
 
Norm Radder
Rancher
Posts: 4504
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

buttons are not displayed


Look at what the getTableCellRendererComponent method in the ButtonRenderer class returns.  Change it from null to what is required.  See the code at the link that I provided.


I think an array of string is better than an array of int


Why is there a nested loop in the listFiles method?  What is the purpose of the outer loop?
 
ronald deux
Ranch Hand
Posts: 230
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again
I have advanced a little
I followed your link, the buttons are there but do not follow each other or the idea of a loop around listFiles () that I removed
and when I double click on the first button,
the button disappears to make way for a white cell
thank you
 
Norm Radder
Rancher
Posts: 4504
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the program do what you want now?
 
ronald deux
Ranch Hand
Posts: 230
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no the buttons are not displayed numbered 01, 02, 03 etc
I am now working on mouseClicked and JProgressBar
when I click on a button and since I have 3 files, the 3 progressbars start
I am now trying to create a code that allows to launch a progressbar when I click on a button
not easy
 
Norm Radder
Rancher
Posts: 4504
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post the new code that shows what you are talking about?
 
ronald deux
Ranch Hand
Posts: 230
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator




for now, the code is not clear, I would say
 
ronald deux
Ranch Hand
Posts: 230
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the link you gave me from SO, I would like to know if when you click it concerns the first column regarding mouseclicked
 
Norm Radder
Rancher
Posts: 4504
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post all the code so that it can be compiled and executed for testing.
 
ronald deux
Ranch Hand
Posts: 230
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator






no problem
 
Norm Radder
Rancher
Posts: 4504
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One problem is that the ButtonRenderer class defines a Button instead of using the one passed to it.

The code in an older post worked better than this last post.
 
ronald deux
Ranch Hand
Posts: 230
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes it's two buttons together if I understood correctly
I am thinking
I drop JButton and buttonRenderer and I click on the cell with rowAtPoint and columnAtPoint
i think this is the best i can do
what old code are you talking about?
 
Norm Radder
Rancher
Posts: 4504
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

what old code are you talking about?


The full  code posted before the last full code post in this thread:  JTableTest

Why isn't a JButton being added in to the row in the listFiles method?  I see code that is commented out that adds a String not a JButton.
The old code added a JButton on line 77.
 
ronald deux
Ranch Hand
Posts: 230
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JTableTest works fine but the 3 progressbars work together when I click on the big button at the bottom, I have not found how to run one progressbar at a time

Let’s come back to Jbutton, we have to make an array of jbutton or not for the listfiles () method;
 
Norm Radder
Rancher
Posts: 4504
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JButtons can be created in the listFiles method as the code used to do.

 have to make an array of jbutton

What would that array be used for?
There is No need for a separate array outside of the current code.


JTableTest works fine


Ok, then what is the purpose of the new code: JTableModel?
 
ronald deux
Ranch Hand
Posts: 230
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i thought i would make a table model and then create classes like buttonrenderer or progressbarrenderer or mouseclicked
but hey I can change the name of jtablemodel
 
Norm Radder
Rancher
Posts: 4504
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have new code with a problem?  Post the code and a description of what it does wrong and what you want to change about how it is working.
Then pick a single problem to work on. When that problem is fixed, then move to the next problem.

Posting whole new versions of code with many changes made from the last posted code makes it very hard to follow what problem you are trying to solve.  Work on one thing at a time.
 
ronald deux
Ranch Hand
Posts: 230
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK I understand
but I don't see how to add a button to row [0] in the listfiles method
it always comes down to the thong as you say
like this below when I click on a button


javax.swing.JButton[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@7487b16f,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Button n 00,defaultCapable=true] 01 - 60s rock beat.wav 0:00:16
 
Norm Radder
Rancher
Posts: 4504
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I don't see how to add a button to row [0] in the listfiles method


See line 77:
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic