TextPan Bold

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         

        // TODO add your handling code here:

        

         StyledDocument doc = textPane.getStyledDocument();

                int start = textPane.getSelectionStart();

                int end = textPane.getSelectionEnd();

                

                

                Style style = textPane.addStyle("BoldStyle", null);

                StyleConstants.setBold(style, true);

                

                doc.setCharacterAttributes(start, end - start, style, false);

        

    }     

Comments

Popular posts from this blog

Remove (Clear) and remove Selected element

JSpinner

🛢️ MySQL Connection & CRUD Operations in Java