• 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

 
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 think I've already seen this code, thank you

I do not know if I can play music, it's why I ask myself the question

I give you a code for the operation of the progress bar if it can help you, it's a code I found in Java2s, I modify a little
but make work with three songs, it's something else
I'm not here yet

 
Saloon Keeper
Posts: 8704
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Haven't seen that code before. Can it play music?
 
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 works with a song and the progress bar as well as the console that indicates the duration of the song

You should know Java2s
I give you the link

http://www.java2s.com/
 
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 seek everywhere how to use string.format to transform the getSeconds in 00:00:00
I even try to transform this formula
 Return (long) ((double) frames / format.getframerate ());
In format 00:00:00
It does not give anything
Do you have some tips to give me?
thank you
 
Carey Brown
Saloon Keeper
Posts: 8704
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you show me the snippet where you are using it?
 
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
Wait
I have to start coding it again
 
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 have to do it like that, I do not remember anymore
but it does not work
 
Carey Brown
Saloon Keeper
Posts: 8704
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could have called formatDuration() separately but seeing as you didn't you then have the problem of matching return types. What type does String.format() return?
 
Carey Brown
Saloon Keeper
Posts: 8704
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, "%d" requires an int or long argument and you are giving it a double.
 
Carey Brown
Saloon Keeper
Posts: 8704
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would have been simpler and cleaner as
row[ 1 ] = formatDuration( getSeconds( file ) );
 
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 have to try
I'll keep you informed
 
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
it works
I am satisfied with keeping valueof
I spent a lot of time looking when it's all beast
 
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
now I will try to play 3 songs
one after the other as the progress bars
I think I do a for loop of songs, I do not know if it's a good idea
 
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
Have you managed to play music with file [] Listfiles or the first lines of the first column with 3 songs or more?
 
Carey Brown
Saloon Keeper
Posts: 8704
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have I? The last of your code I compiled didn't play anything.
 
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
What code are you talking about?
That of JProgressBar07 or JTable09?
 
Carey Brown
Saloon Keeper
Posts: 8704
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What code are you talking about? I glanced at java2s and your latest player but haven't done anything with it. So why are you asking me if I can play 3 songs?
 
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 do not know
sorry
 
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


Exception in thread "main" java.io.FileNotFoundException: 60s rock beat.wav (Le fichier spécifié est introuvable)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:211)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:153)
at java.desktop/com.sun.media.sound.SunFileReader.getAudioInputStream(SunFileReader.java:117)
at java.desktop/javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1062)
at JTableTest.main(JTableTest.java:54)


I found a piece of code
I modified it a little, I hope I have not made an error
I do not understand the error
Yet i have the 60s rock beat.wav file in my folder
line 54 is line 8
 
Carey Brown
Saloon Keeper
Posts: 8704
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would depend on what directory the file is in and what directory you were in when running the program. Put in a print statement:
 
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 give you all the code
I'm having fun, it's a bit of the disorder
I will arrange after
it's bizarre I always have the same error
 
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 come back to you
i am modifying my jtable jprogressbar
I'm trying to create an array of numbered buttons for the first column and a numbered button for each row
I give you part of the code
Thank you for your help
 
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 happens when you compile the code?
If there are no compiler errors, what happens when you execute the code?

Also please post the complete code that 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




ok I'll give you all the code
for now nothing is working
because I am redoing it and the code is not finished
 
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
can you please tell me how to show you eclipse IDE window when compiling
so you can see the error displayed on the window in the first column
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
Sorry, I don't know how to get the error messages from your IDE.  Often error messages are displayed all together in a window where they can be copied.  
 
Carey Brown
Saloon Keeper
Posts: 8704
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cut and paste.
Go to the IDE and drag mouse over the text to highlight it. Press Ctrl+C
Go to The Ranch and start a new post, click the mouse once in the edit box, press Ctrl+V
 
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
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

Thanks for the explanation
 
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 did you just post?  It looks like the String created by a toString method for a component when it is printed in a println statement.
 
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'm trying to create an array of numbered buttons
that's the number 1 button supposedly
 
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 statement created that String that you posted?  Is that statement in the posted code?
 
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
 
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 think the error comes from int [ ] buttons
 
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 think the error comes from int [ ] buttons



What error is that?  You have not posted any error messages yet.
 
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
It should display Button n 01, Button n 02 in the first column but instead I have this string as you say
 
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

instead I have this string



Where do you see that String?  Have you changed the code?

Please post the new code.
 
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


here is my new code

 
Bartender
Posts: 4667
183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the code hou showed about 30 minutes ago, your buttons array has length 1, so the j-loop is executed for j = 0, and row 0 has a String based on  j.
 
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 don't know what to choose between int and string
if I choose int [] buttons = {3}, for example, I risk being blocked if I have 5 files in my directory
 
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 of the code that shows that the listFiles method is being called and that the class's constructor is called.

 what to choose between int and string


What do those data types have to do with the number of rows to create?
What is the outer loop supposed to control?  The inner loop is for the number of rows.
What is the outer loop for?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic