Added: 2 years ago
From: thenewboston
Views: 60,484
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (376)

Sign In or Sign Up now to post a comment!
  • I dont really think this willl get replied too but whenever i type "s.setFullScreen(dm, this);" and "s.restoreScreen();" it says i need to create the setFullScreen in the screen class...but its already created...same as restoreScreen please help

  • on line 19 you use setFullScreen

    but in the Screen class you made, it's called setFullScreenDevice (so change to this)

    I hope that helps anyone. I had this problem.

  • Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method setBackground(Color) is undefined for the type bucky The method setForeground(Color) is undefined for the type bucky The method setFont(Font) is undefined for the type bucky The method setFullScreen(DisplayMode, JFrame) in the type Screen is not applicable for the arguments (DisplayMode, bucky) at bucky.run(bucky.java:13) at bucky.main(bucky.java:9)

    WTF!!!!!!!

  • @MinecraftEliteGamer At the beginning of your class (public class bucky) its supposed to say

    public class bucky extends JFrame

  • @draken4200 You have just fixed all of my problems, thank you soo much :)

  • java.lang.NullPointerException gooddammmnitt!!!!

  • public void paint(Graphics g) { g.clearRect(0,0,getWidth(),get­Height()); g.drawString("This is awesom", 200, 200); }

  • I'm using latest JDK and works fine for me. Bare in mind 'void paint' is case sensitive. Must be lower case.

  • Mine doesnt turn pink. It turns black

  • bucky i am not getting the pink screen ...what wrong with that..????

  • its not turning pink

  • People, don't forget to extend the bucky class with JFrame

    public class bucky extends JFrame

  • I have an error in my code! setBackground and setForeground and setFont goes red and says it's undefined for type 'bucky'. 1 quick fix: createMethod 'setFont(Font)'

  • @crisisminers same

  • @crisisminers the complete fix = setFont (new Font("Arial", font.PLAIN, 24));

  • this refers to the instance of object bukey (a JFrame), minute 5:20, not to "Screen s" object. Sorry if this confuses anybody, or if this subject was discussed .

  • Guys why I got white screen and not pink just white but script is same as boston

  • put this

    g.clearRect(0, 0, getWidth(), getHeight());

    g.drawString("Hello My Screen", 200, 200);

    it works

  • When I run this it says:

    Exception in thread "main" java.lang.NullPointerException at screen.toNormalScreen(screen.j­ava:26) at game.run(game.java:21) at game.main(game.java:8)

    What's going on?

  • @TriCrose it means you messed up some were watch the video again and see if u have something different then what bucky has

  • For those who are having problems with the background not changing, insert "paint.super(g);" above the g.drawString line. 

  • I'm getting a major problem with my Screen class now. Everything works fine up until the point where it restores the window, and I get an Invalid display mode IllegalArgumentException right after the dispose() method, on vc.setFullScreenWindow(null);.­.. Not sure what I should do, because I had it working at one point.

  • is s.restoreScreen(); a built in method? it's not recognizing it in my program :(

  • @korkypnoy I had the same problem i realised what went wrong, in the class screen or whatever you named your class for the screen, you made a method to restore the screen. This is whats wrong, you either gave the method a different name or you didnt make it.

  • im on Ubuntu if that matter but i did background orange and it made it an orange gradient

    why?

  • i get loads of errors on the setBackround, SetForeGround and SetFont

  • I get a problem, the console tells me "java.lang.NullPointerExceptio­n", what's that suppose to mean? Help please!

    

  • How do you add TextField in Full Screen mode?? I know how to add in normal form applet but i'm stuck in full screen. Help please!!

  • Same with the color problem, but I got so excited I didn't even care :D:D:D:D:D

  • I get an error on setBackground, setForeground and setFont. It says that i should create a method 'setForeground(Color)'

  • @TheBestLucarioFan Did you write this:

    "public void run(DisplayMode dm){ setBackground(Color.PINK); setForeground(Color.WHITE);"

    Because you might've wrote this instead:

    "public void run(DisplayMode dm){ setBackground(Color.PINK); }setForeground(Color.WHITE);"

    Because if you make a method with neither Public or Private as modifier, it's public to anything in the same package, but nowhere outside of that package. But make sure setForeground is still in the method.

  • @TheBestLucarioFan Did you remember to make bucky extend JFrame?

  • How else wants that Print Screen as their Desktop background?

  • Did you delete the stuff in bucky and start over with that, or did you create a new class file?

  • who would dislike these videos?

  • Could not find or load main class Bucky this is my problem. where is the solution?

  • I found a solution for the problem with the black screen.. Hopefully it will help you guys too:)

    Change

    setBackground(Color.PINK);

    setForeground(Color.WHITE);

    To this:

    setBackground(Color.pink);

    setForeground(Color.white);

  • Black Background... anyone else lol?

  • @hoddie54 me.... I get the letters fine, but the bg is black :'(

  • g.clearRect(0, 0, getWidth(), getHeight());

  • Comment removed

  • I have the same issue as Gooter, it all runs fine and text appears and I can change all that except the background colour is always black. It wont change. Any help would be appreciated.

  • Nevermind, I fixed it:3

  • Mine didn't work until I change run to rn:l

  • oooohhh.... as soon as you set some text(or image(anything)) the screen will be fine.

  • Comment removed

  • Wonder why Notch didn't do this...

  • @QuantumSicarius cu he didnt want minecraft to be full screen.

  • @OCoptimusconvoy Press F11 and see what happens XD

  • It runs just fine but i don't get a pink screen! It's black no matter what color I choose and if I let it sleep for a longer time, whats wrong?!

  • @Goooter I have the EXACT same problem, I haven't fixed it yet, I just in the Paint() method put a g.setColor(Color.pink);

    then put a g.fillRect(0,0,800,600);

    then set the color back to white and had the text be displayed and it looks like it would

  • i got a black background help please

  • Er, my background was black, but it still worked

  • @julienmauricemort yeah same here i don't know whats wrong with it

  • ye compiler consa he

  • Thanks, this is awesome ! :)

  • how about the fullscreen like ALT+F4 ?

  • 5:32 TryCEPTION! :3

  • Im getting the words but the background just isnt working for me idk what the problem is

  • When I ran mine I just got really excited and it was just... epic. Thank you bucky!

  • Mine is not turning pink for some reason. Help!

  • @rambolikesCOD

    did you import awt.*;?/read the top comment.

  • @SnowfireGames i did import that and i looked at the top comment neither worked.

  • @rambolikesCOD try to let the thread sleep for longer. It might be that your pc is a little slow :P

  • @rambolikesCOD Let it sleep to 10000 then.

  • @rambolikesCOD

    DisplayMode(500,400,16, DisplayMode.REFRESH_RATE_UNKNO­WN);

    //try changing the resolution

  • Thanks for all.

    I dont understand "this" statement in setFullScreen. We pass there the s object or bucky?

    If we pass s why??? it is not a JFrame object...

    Thanks in advance.

  • @LiberulArbitru this means the object created from this class (bucky). so he passes a bucky object by "this", not the s.

  • Comment removed

  • Wow, Java is so easy.

  • how do u run as?

  • strange episode to ask, which version of Eclipes do you use, Java EE Devs or just Java Devs?

  • Comment removed

  • GraphicsEnvironment cannot be resolved.... I have imported everything, retyped 5 times and to no avail. Please someone help?

  • @Corhunger Nevermind... It seems it did not like the keyword 'new'.

  • im getting this error message Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method setFullScreen(DisplayMode, Main) is undefined for the type Screen The method restoreScreen() is undefined for the type Screen

  • It was just a black screen with the text I posted, no pink or anything

  • Hmm, my setForeground and setBackground is saying to create a new method for them. What should I do?

  • @JamEngulfer221 did u do the imports correctly?

  • @14koder I think so. It didn't suggest I import them when I hovered over them. Should I have, because I think I imported java.awt.*

  • How i can make a not Fullscreen Display?

  • Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentExcep­tion: Antialiased text mode is not compatible with Global antialiasing enable key

    i get this error with java 7

  • :) thanks

  • i DON'T KNOW WHAT ARE YOU SAYING

  • Thank you very much Greg||bucky, I've watched all your Java Programming Tutorials during 3days. I've studied a lot from you.

    I've got some problem. When I start this program on Windows 7, it have errors in this code:

    public void restoreScreen(){ Window w = vc.getFullScreenWindow(); if (w != null){ w.dispose(); //problem here } vc.setFullScreenWindow(null); //and problem here }

    But the same program is working perfect on Windows XP.

    Excuse me for my English.Thanx

  • Did you guys out the "public class bucky extends JFrame {

    ?

  • what do i select as the main class?

  • thenewboston's videos are teaching me ten times more than my college professors...

  • help weird error? Could not find or load main class bucky

  • Screen s = new Screen();

    ^

    ?? cant find symbol class Why tho??

  • when i type "b.run(dm);" i get "- Syntax error on token "dm", VariableDeclaratorId expected after this token - Syntax error on token(s), misplaced construct(s)"

  • 2:52, this is a comment for me cos im gonna stop watching for now resume bit later :)

  • Where is the DisplayMode method? does anyone know the video or the code for it??

  • I get screen, but there is no text on it .. ?? Compiled using NetBeans 6.9 on Fedora15

  • I get an error on s.setFullScreen(dm, this);

    It wants me to change something in the screen class, but when I do, It screws up and makes tons more errors.

  • please help me..i tried this on netbeans..when i run the project it says

    build successful (total time 5 seconds) but nothing come on the screen..

    what to do??im confused..please help

  • Comment removed

  • Exception in thread "main" java.lang.Error: Unresolved compilation problem: at display.main(display.java:5) help

  • That awkward moment when you forget extends JFrame...

  • @michaeldcurry1 my god... the same thing happened to me, and because of your comment, it is fixed. i love you.

  • @mransom565 :L No problem, it drives you crazy right?

  • @michaeldcurry1 Lol I was scrolling down to write a comment about getting an error on "setBackground", read your comment.... Oh thx bro lol

  • @AutomatonGames :L Yeah, loads of people forget it.

  • @michaeldcurry1 Thanks you sooo much, its beeen like and hour im trying to fix my prob XD

  • Guys help me, i did this by netbeans and it says:

    Exception in thread "main" java.lang.NullPointerException

    at jotai.screen.restoreScreen(scr­­een.java:44)

    at jotai.Mainn.run(Mainn.java:39)

    at jotai.Mainn.main(Mainn.java:24­­)

    Java Result:

  • We have taken over our entire screen... now onto the rest of the world!

  • Yo dawg, we put a try block inside yo try block, so you can catch yo thread while you catch this!

  • Central*

  • For centrak letters do 325,325

  • I got this error when running everything from the last video:

    Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method setFullScreen(DisplayMode, Main) is undefined for the type Screen The method restoreScreen() is undefined for the type Screen at main.Main.run(Main.java:18) at main.Main.main(Main.java:8)

  • why are the letters not centered?

  • Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method setBackground(Color) is undefined for the type bucky The method setForeground(Color) is undefined for the type bucky The method setFont(Font) is undefined for the type bucky The method setFullScreen(DisplayMode, JFrame) in the type Screen is not applicable for the arguments (DisplayMode, bucky)

  • @TwBit

    you probably forget to extends JFrame

  • @tomatocurry1 Son of a bitch... that was it, thank you so much.

  • Please someone reply!!!!!!!!!!!!

    Where do you put the g.clearRect(0, 0, getWidth(), getHeight());

    Please put the code for me!!!!!!! public void paint(Graphics g){ if(g instanceof Graphics2D){ Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingH­ints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTI­ALIAS_ON);

  • Comment removed

  • Can any one help me i get a white screen =S

  • HELP I GOT THIS ERROR

    Syntax error on token "DisplayMode", delete this token REFRESH_RATE_UNKNOWN cannot be resolved or is not a field

  • @Undeadflayme Are you familiar with java at all? if not then it will take you a while to figure it out.

  • @RASHTG thanx that was helpful -_-

  • mine wont work:

    Screen s = new Screen(); try{ s.setFullScreen(dm, this); try{ Thread.sleep(5000); }catch(Exception ex){} }finally{ s.restoreScreen(); } } public void paint (Graphics g){ g.drawString("This is gonna be awesome", 200, 200);  }

  • why pink dindnt function?

    public void run(DisplayMode dm){ setBackground(Color.PINK); setForeground(Color.RED); setFont(new Font("Arial", Font.PLAIN,24)); Screen s = new Screen(); try{ s.setFullScreen(dm, this); try{ Thread.sleep(5000); }catch(Exception ex){} }finally{ s.restoreScreen(); } }

  • @TheFedegaza1

    it is same with me

    i asked that question on the other post too

  • why does it say the setBackground(Color.PINK); is wrong???

  • i just set the resolution for fullscreen to 1680,945 its my screen resolution xD

  • @TheVSTutorial Yeah, I tried that first and it didn't make a difference in my case - wish it did though; it would have been an easier fix. In my case, the resolution was irrelevant as whether 800, 600 or 1680, 900, I still got a full screen display with the fix I have below. On their own, they did nothing. I even put my own refresh rate by changing the Display.Mode.REFRESH_RATE_UNKN­OWN call with a 60 - still didn't work.

  • If you're your screen flashes black and you see nothing at all, or this just plain doesn't work, try removing or commenting out this line of code from Screen.java:

    { vc.setDisplayMode(dm); } - just leave the try/catch block empty and save the file.

    Now go to your main, in this case, your Bucky.java class, and change the OS from 16 to 32 or 64 bit accordingly in this line of code:

    { DisplayMode dm = new DisplayMode(800,600,32, DisplayMode.REFRESH_RATE_UNKNO­WN); }

    Save the file, and run.

  • @lnfiniteKnowledge Thanks for the help, but once i do this (no matter what change, 32, 64) it has a transparent screen, but the writing (this is gunna be awesome) is still there in the color i chose. Can you help please?

  • 3:15 White isn't a color! It's a shade! Java's wrong!

  • bah i had wrote setBackground(color.PINK) instead of setBackground(Color.PINK)

    sortedAndOntoTheNext

  • neat

  • Woot it works

  • omg wtf i done exactly what he done, and setBackround foreground and font all come up red, and setFullscreen

  • @MrJimarla oops i forgot to make it extend JFrame

  • @MrJimarla Had the same problem, thanks!

  • THIS IS AWESOME! XD

  • If you are getting a black screen, try add this code at the top of your paint() method:

    g.clearRect(0, 0, getWidth(), getHeight());

  • @gfloodsie thx

  • @gfloodsie THANKS!!!

  • @gfloodsie TTTTTTTTTTThhhhhhhhhhhhhhhhhhh­hhhaaaaaaaannnnnkkkkkkkkkkkkk yyyyyyyyyyyyyooooooooooooooouu­uuuuuuuuuuuuuu so much now it works

  • @gfloodsie Thanks!

  • @gfloodsie this worked but it cuts the sides of my screen short so that it's not truely full screen

  • @gfloodsie WoW ! 

  • interesting i got it to work

  • I am getting a runtime exception

    Exception in thread "main" java.awt.IllegalComponentState­Exception: The frame is displayable. at java.awt.Frame.setUndecorated(­Unknown Source) at screen.setFullScreen(screen.ja­va:13) at buck.run(buck.java:23) at buck.main(buck.java:8)

    Also the screen looks black. What do I do.

  • when i tried to compile it the first error i get is that it GraphicsEnviroment doesnt work so the Screen method is broken the second is all the setForeground() things dont exist so none of this works please someone help me

  • my screen has no background it is just transparent

  • what I don't like is when you change the code in a file w/o us seeing

  • We won't handle it. Cause I don't plan on messing up. ^_^

  • @iosonoxx Thanks very much! You are the man!

    <3

  • Hey guys could someone please help me?

    I did exactly what's on this tutorial and on the previous one (reviewed 3 times)

    But when I run the application, my screen just goes black, nothing appers on it,

    and then after a few seconds the application closes (as it should).

  • how would you create it as a web applet rather than full screen or window?

  • @DGArtistsInc

    make sure you have "public class bucky extend JFrame { ....

    } "

  • man display is coming but only wite screen no pink and font after 2 seconds its going y??

  • I can set the Foreground and Font, but not the Background?

  • I would help if bucky put the code for his classes in the description so we can see where we made an error if we did

  • how come bucky used to type at the start of the string main (String args[]) and now he does (String[] args)... Does it make a difference???

  • @ThEwOtSiT182 no. It's just 'tradition' or 'etiquette' to use String[] args.

    But when declaring any other array of variables, it's best to use, for example, int arrayofints[].

  • I didn't have the black screen problem like everyone else is talking about

  • Can you help me? My screen just turns black but the text shows up. I try every single color for my background but it just stays black. Whats wrong with it.

    Thank you for your help

  • @sirmellocello same here...

  • Oh another thing, if you set the resolution to be the same as your monitor's natural resolution, it will run smoother.

    My monitor is naturally 1920x1080 so changing it to 800x600 makes it pause for a couple seconds before displaying anything at all. But setting it to 1920x1080 it pops up instantly no problem.

    Danm I/O

  • Hey if any of you guys are having issues with this not displaying anything on your monitor, it could be the refresh rate,

    so for the line:

    DisplayMode dm = new DisplayMode(800,600,16, DisplayMode.REFRESH_RATE_UNKNO­WN);

    try changing it to:

    DisplayMode dm = new DisplayMode(800,600,16,60);

  • It works! .. except the background is always black no matter what I set it to on all bit depths. Any suggestions? I think it might just be laptop suckage.

  • hi

    really thanks for this tutorial and i learned many useful things from it

    but when i tried this code it give me an exception can u help me?

    the exception is: Exception in thread "main" java.lang.IllegalArgumentExcep­tion: Invalid display mode at sun.awt.Win32GraphicsDevice.se­tDisplayMode(Unknown Source)

  • hi

    my name is mahmoud

    really thanks for this tutorial and i learned for it many useful things

    but when i tried this code it give me an exception can u help me ?