Java Swing GUI: Text Wrap, Center Text, and Custom Font? -


I have a JPN (and I have also tried a jettext) that I would like to read on this

  • Wrap the word
  • Use a custom font from a .ttf file that I'm currently using No on the computer I already installed This problem has been solved, and the font works fine, it does not work even when the tag is placed as I have seen it as a possible solution to my problem.
  • I generally get two of these rules to work, but for working in all three times, I have tried HTML tags, JLabels, JTextAreas, but no one Any suggestions do not even satisfy all the conditions?

    Fixed JTextArea quesLbl; QuesLbl = new JTextArea (""); QuesLbl.setWrapStyleWord (true); QuesLbl.setLineWrap (right); QuesLbl.setEditable (wrong); QuesLbl.setFont (qFont); QuesLbl.setOpaque (true); QuesLbl.setForeground (Color.WHITE); QuesLbl.setBackground (Color.BLUE);

    This code is the word written in the resulting word, and the font is working, but not centered.

    You think that horizontally centered, I use a JTextPane I would recommend I did not test, but I hope that setting up your font will work properly. For the center, see, I'm referring to the answer:

      public JTextPane createTextPane (string text) {JTextPane textPane = new JTextPane (); Tp.setText (text); StyledDocument doc = textPane.getStyledDocument (); SimpleAttributeSet Center = New SimpleAttributeSet (); StyleConstants.setAlignment (center, style resolution. ALIGN_CENTER); Doc.setParagraphAttributes (0, doc.getLength (), Center, False); +}  

    IIRC word wrap should come free. Hope it helps, if not, clarify the question.


    Comments