Results 1 to 8 of 8
Like Tree1Likes
  • 1 Post By camickr

Thread: quick swing toolbar question

  1. #1
    smacker is offline Member
    Join Date
    Jan 2011
    Posts
    44
    Rep Power
    0

    Default quick swing toolbar question

    i'm looking to build a notepad
    now i need to do the copy paste and cut in the toolbar
    my my question is how do i access the marked text
    like if i mark a text inside the text box and i want to make the function work on him
    please help with some direction

    thanks a lot to all helpers !

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,691
    Rep Power
    8

    Default Re: quick swing toolbar question

    Have you consulted the API at all? It should be your best friend.

    Java Platform SE 6
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    smacker is offline Member
    Join Date
    Jan 2011
    Posts
    44
    Rep Power
    0

    Default Re: quick swing toolbar question

    ok i found the clipboard thing in there should be usefull with the set and get content but the question remains
    how do i reffer the button to a marked text in the textbox

  4. #4
    smacker is offline Member
    Join Date
    Jan 2011
    Posts
    44
    Rep Power
    0

    Default Re: quick swing toolbar question

    .getselectedtext , just found it
    am i going the right way with this ?

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default Re: quick swing toolbar question

    All Swing text components such as JTextField, JTextArea, JEditorPane and JTextPane ultimately derive from JTextComponent which has cut(), copy(), and paste() methods. I would simply start with those methods first.

  6. #6
    smacker is offline Member
    Join Date
    Jan 2011
    Posts
    44
    Rep Power
    0

    Default Re: quick swing toolbar question

    hehe yea that pretty much settles it , didn't know that was there , got all complexed

    thanks a lot to all

  7. #7
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,226
    Rep Power
    6

    Default Re: quick swing toolbar question

    now i need to do the copy paste and cut in the toolbar
    Use the default Actions provided by the editor kits:

    toolBar.add( new JButton( new DefaultEditorKit.CutAction() ) );

    See: Text Component Features (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components) for a more complete working example.
    Fubarable likes this.

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: quick swing toolbar question

    Moved from SWT/JFace

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Quick question.
    By juxta in forum New To Java
    Replies: 11
    Last Post: 12-09-2011, 03:23 AM
  2. Quick Question
    By mDennis10 in forum New To Java
    Replies: 4
    Last Post: 09-30-2011, 04:48 AM
  3. Really Quick question
    By Ryan10 in forum New To Java
    Replies: 63
    Last Post: 03-02-2011, 02:11 AM
  4. Swing class 2-column toolbar
    By GPB in forum New To Java
    Replies: 0
    Last Post: 04-29-2010, 10:16 AM
  5. Really quick question
    By shadycharacter in forum New To Java
    Replies: 2
    Last Post: 04-22-2010, 10:06 PM

Posting Permissions

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