I have a JTextPane in which text color is set as blue by default. Now i added strike-through on text then strike-through color becomes as same of text (blue). I want the color of text and strike-through different. e.g. if text color is blue then the strike-through must be different.
Please give me some idea.
JTextPane text = new JTextPane();
Font font = new Font("Serif", Font.ITALIC, 20);
text.setFont(font);
text.setForeground(Color.BLUE);
Style style = text.addStyle("Bold", null);
StyleConstants.setStrikeThrough(style, true);
text.setCharacterAttributes(style, false);
1 Answer