This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swing JTextPane on Solaris/Linux

 
Rayudu addagarla
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Working for a long time in windows platform.I am new in working in Java in Unix world.
Problem: JTextPane [javax.swing.text.JTextPane]
Even when the JTextPane is set to Editable false the paste operation is working. I worked the same example in windows,it does not allow to type or paste anything.
But in unix,solaris/Linux redhat: it does not allow me to type ,but when i use the middle button in solaris content in clipboard is getting paste inthe JTextPane.
i tried to override the paste method [in JTextcomponent class] to do nothing. even then its pastes.
What is the method that invokes when middle button is clicked in solaris or two buttons clicked at same time in linux.?
I am thinking Ctrl+V in windows is equavalent to middle button click in solaris.
bottom line.I don't want the JTextPane to take any paste operations.
-Rayudu
here is what i did:
class JtPane extends JTextPane
{
public JtPane()
{super();}
/*overide paste method of JTextComponent*/
public void paste()
{System.out.println("Paste Disabled");}
}
/*works in windows but not in solaris??*/
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
this should work (for JTextPane, as well):

cheers,
Chantal
 
Rayudu addagarla
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chantal ,
Great!! It Worked
I did not know about the consume method.
thanks
-rayudu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic