#Java formatting issue

107 messages · Page 1 of 1 (latest)

limpid novaBOT
#

This post has been reserved for your question.

Hey @dire jasper! Please use /close or the Close Post button 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.

paper finch
#

your code should work fine there, make sure to save and rerun?

dire jasper
#

im trying to fix the format

paper finch
#

yeah, i mean the formatting should work

#

it is part of your code..

dire jasper
#

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

paper finch
#

yes, im saying your formatting should be able to do that?

dire jasper
#

I know thats what im saying too

#

but it doesnt

paper finch
#

can you send your thing as text

dire jasper
#

the output?

#

or the code

paper finch
#

(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

dire jasper
#

yeah it does

#

this is the whole output

#

but im only worried about the first part

#

which is the first method i sent

paper finch
#

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

dire jasper
#

these are the two methods with the string format

paper finch
#

yeah that's the issue i mentioned

dire jasper
#

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

paper finch
#

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

paper finch
#

uhhh it'd probably be more of a cell, i meant Owner in the header row there, sorry

dire jasper
#

oh yeah np

#

i see

#

so how could i align it

#

when if i left align the column for owner it just messes up

paper finch
#

make the Owner header right-aligned like its content

dire jasper
#

i did that

#

but some elements are messed up with width

#

so do i have to change the time as well?

paper finch
#

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

dire jasper
#

how can i make time and owner close, like this:

#

i think it needs to be left aligned?

paper finch
#

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

dire jasper
#

so should i remove all of them?

paper finch
#

no, just for the OWNER column

dire jasper
#

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

paper finch
#

%s for that last one

dire jasper
#

it outputs this

paper finch
#

that's... still literally just the same thing

dire jasper
#

i know

#

it didnt do anyhting

#

lol

#

see i put %s

paper finch
#

did you save and restart

#

it looks like you haven't done that since last time

dire jasper
#

i did

#

it autosaves but i just saved in case

paper finch
#

ok but like your output is literally the exact same

dire jasper
#

not its elements

#

if i change the elements

#

i get this

paper finch
dire jasper
#

but this is too close

paper finch
#

and your Time header still has padding, there's an issue there

dire jasper
#

whats padding?

paper finch
paper finch
dire jasper
#

i should have known

#

lmaoo

dire jasper
paper finch
#

.

dire jasper
#

after a number

#

if i try

#

this happens

#

thats where i add it

paper finch
#

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?

dire jasper
#

either is fine

#

i just want it to look like this

paper finch
#

....which is right justification

dire jasper
#

it looks almost identical

#

thnx for help btw

#

appreciate it

paper finch
#

your numberSong is scoped incorrectly to the outer loop

#

it gets reset for every user rather than persisting like in your other method

dire jasper
#

damn

#

that was fast

#

lol thnx

#

ur a goat