• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using HTML with JPopupMenu  RSS feed

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I guess this is maybe more of an HTML question. I was hoping someone could help me out with. Rather than going through the headache of displaying a JTable off of a popup menu , I decided to use HTML and create a table.
It works great, however I can't seem to get the spacing correct on it.
I have 5 columns in this table, and not every column in every row has data in it. I've noticed in HTML if you type blank spaces, it doesn't matter, it still doesn't space it out.
My table kind of looks like this:
1/4 .250
3/8 .375
1/2 .500
Right now, to space it, I am using underscores in the blank spaces in the columns, but that kind of looks poopy, so I was wondering if anyone could help me out on how to make table columns all the same size (without using column header) in HTML??
Thanks for any help! (Sorry if this isn't in the right forum. I just figured since I was using HTML with Swing, this is where I needed to go!)
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please post the HTML that you are using? I didn't have any problems with the HTML Table completely ignoring empty cells. Turn on table borders using <TABLE border="width(int)"... to make sure your cells are where you think they are. I would normally suggest using <COLGROUP> and <COL> tags, but it looks like Swing doesn't recognize those... though it looks like if you use <TABLE width="int"... the table will give more space to empty cells.

You might as well just use a JTable... just use DefaultTableModel to hold your data and create a JTable using that. As long as you don't add the JTable to a JScrollPane you won't get any headers.
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops! Disregard the problem with HTML table not aligning. I was doing something stupid, and found the problem. However, I did take your advice and use a JTable instead of using HTML. It turned out to work out better for me than the HTML. Thanks for the advice!!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!