Results 1 to 7 of 7
Like Tree2Likes
  • 1 Post By kadaj13
  • 1 Post By gimbal2

Thread: graphic programming

  1. #1
    kadaj13 is offline Member
    Join Date
    Dec 2013
    Posts
    2
    Rep Power
    0

    Smile graphic programming

    Hi guys Im new to java and dont know about graphic programming in java.
    I want to write a project that is similar to notepad
    things i have to do is to make a place to write characters and have a cursor and when i push the page up key the cursor goes the line above and some other things in real notepad ( deleting, backspacing, home, End, ... )
    I dont know how should I write these
    can anyone help me?! :) thanks :)
    kasra likes this.

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    936
    Rep Power
    2

    Default Re: graphic programming

    Well, create a class, instantiate a JFrame, add a JTextPane. Bosh, done.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,894
    Rep Power
    5

    Default Re: graphic programming

    Well Java wouldn't really be the right choice for your project since you might as well create a simple Swing application with a single JTextArea in it and you're done - its so nice and high level that its not really a sane thing to do these kind of low level projects with it :)

    But if you must do all the work yourself, you'd need to look into Swing custom painting, event handling and timing at the very least. The Swing tutorial would be your starting point:

    Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)

    Lesson: Performing Custom Painting (The Java™ Tutorials > Creating a GUI With JFC/Swing)

    Lesson: Writing Event Listeners (The Java™ Tutorials > Creating a GUI With JFC/Swing)

    How to Use Swing Timers
    Last edited by gimbal2; 12-10-2013 at 02:16 PM.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    936
    Rep Power
    2

    Default Re: graphic programming

    I am curious what the responses would be if I posted this on a mechanic forum:

    I am new to mechanics, and don't know anything about combustion engines. I want to create a device that can transport me over great distances, must have 4 wheels, a steering wheel and minimal 4 seats.
    When I push a foot pedal, it must go faster and another pedal must make it stop.
    I don't know how to create this.
    Can anyone help me?! :) Thanks :)
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,894
    Rep Power
    5

    Default Re: graphic programming

    Quote Originally Posted by SurfMan View Post
    I am curious what the responses would be if I posted this on a mechanic forum:

    I am new to mechanics, and don't know anything about combustion engines. I want to create a device that can transport me over great distances, must have 4 wheels, a steering wheel and minimal 4 seats.
    When I push a foot pedal, it must go faster and another pedal must make it stop.
    I don't know how to create this.
    Can anyone help me?! :) Thanks :)
    That is really funny because this morning I was creating a similar tongue-in-cheek response in my head regarding architecture for a future "how do I program this" question :)

    "Hi, I'm an architect and I want to design a skyscraper that is indestructible. Can anyone tell me how to do this?"

    But in the case of a vehicle, I'm sure that you can still get book recommendations at least.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    kadaj13 is offline Member
    Join Date
    Dec 2013
    Posts
    2
    Rep Power
    0

    Default Re: graphic programming

    thankyou all :)
    if java is not the right choice so how can I do this project?! I mean should I learn other languages or ...?! :)

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,894
    Rep Power
    5

    Default Re: graphic programming

    You can do it like I suggested in post #3, using Java?

    Its not really the tool that is the problem, it is the moment in time that you want to do this. You're asking to do really low level things in an age where you have 4th generation languages and high level tools and frameworks to abstract all the low level stuff away. As mentioned, what you want to do can basically be done in a very short time with a couple of lines of code by applying Java Swing or any other GUI framework; create a window, add a TextArea to it, make sure it stretches to fill most of the window and you're already 50% done really.

    So if you want to still do it your way that is fine, but make sure it is only for learning purposes and that it is for the RIGHT learning purposes. Otherwise I'd pick something else to do to learn; if it has to be something graphical, I usually recommend doing a simple game.
    kadaj13 likes this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Please help me in this graphic!
    By joker600 in forum Java 2D
    Replies: 4
    Last Post: 11-23-2012, 09:27 PM
  2. Graphic Approach
    By kammce in forum Java Gaming
    Replies: 3
    Last Post: 10-09-2012, 02:01 PM
  3. Java Graphic
    By Albion in forum Java 2D
    Replies: 2
    Last Post: 12-23-2011, 10:55 AM
  4. How do insert a Graphic
    By carl in forum New To Java
    Replies: 1
    Last Post: 08-01-2007, 05:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •