#Java formatting issue
107 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @dire jasper! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
your code should work fine there, make sure to save and rerun?
it does work, thats not the issue
im trying to fix the format
the elements that are supposed to be directly under the owner column is not under it
so how would I be able to fix that
yes, im saying your formatting should be able to do that?
can you send your thing as text
(also btw if you use a c-style for loop, you can put your number in the formatting as well)
the code
also your output doesn't seem to have a . and your code doesn't seem to have newlines or proper formatting for the numbers. are you sure this is the code that gives this output
yeah it does
this is the whole output
but im only worried about the first part
which is the first method i sent
ok then that's literally just a separate issue
your first output isn't from this
your second output is
your first one is probably using left justification rather than right justification then, %-25s instead of %25s
these are the two methods with the string format
yeah that's the issue i mentioned
i tried using right justification
still same output
oh
nvm
i sold, i changed the wrong one
tysm man
the output looks like this, how could i make it more straight on the owner side
im pre bad with this formatting thing
one sec
your Owner header row is left-justified, and it's after the left-justified Time, so it's misaligned with the content which is right-aligned with a different width
by row do you mean column?
uhhh it'd probably be more of a cell, i meant Owner in the header row there, sorry
oh yeah np
i see
so how could i align it
when if i left align the column for owner it just messes up
make the Owner header right-aligned like its content
i did that
but some elements are messed up with width
so do i have to change the time as well?
that doesn't look like you changed anything
oh yeah your time content isn't padded, but your header is padded a lot more
so remove time padding too
how can i make time and owner close, like this:
i think it needs to be left aligned?
ah, you'd need them to be left-justified then yeah
i mean i guess you wouldn't need justification tbh
just no width at all
so should i remove all of them?
no, just for the OWNER column
im srry, i dont think i understand
String line = String.format("%-25s %-20s %2d:%02d %25s", s.getTitle(), s.getArtist(), s.getMinutes(), s.getSeconds(), u.getUserName());
for that case
how would it look
%s for that last one
it outputs this
that's... still literally just the same thing
ok but like your output is literally the exact same
im assuming its because i only change the owner header
not its elements
if i change the elements
i get this
oh yeah that would do it
but this is too close
and your Time header still has padding, there's an issue there
whats padding?
you can put multiple spaces in the format string directly yknow
whitespace to achieve justification, in this context
omg
i should have known
lmaoo
also how would i put a .
.
ah yeah your number is left justified so the . would be after the padding
if i understand correctly though, you want the number to be right justifified?
....which is right justification