NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

jtextcomponent.getSelectionColor() return wrong color

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
mcheung63



Joined: 18 Dec 2014
Posts: 146
Location: Hong Kong

PostPosted: Sat Mar 18, 2017 4:56 am    Post subject: jtextcomponent.getSelectionColor() return wrong color Reply with quote

Hi
jtextcomponent.getSelectionColor() return wrong color. So how can i get the correct highlight color? please see attachment.
thans
from Peter



Screen_Shot_2017-03-18_at_12.49.50.png
 Description:
 Filesize:  444.9 KB
 Viewed:  1364 Time(s)

Screen_Shot_2017-03-18_at_12.49.50.png


Back to top
emi



Joined: 14 Aug 2009
Posts: 245

PostPosted: Sat Mar 18, 2017 8:14 pm    Post subject: jtextcomponent.getSelectionColor() return wrong color Reply with quote

Is that really the selection color or the background of the current line (caret row) highlighting?


--emi





On Sat, Mar 18, 2017 at 6:53 AM, Peter Cheung <address-removed ([email]address-removed[/email])> wrote:
Quote:

Hi
   jtextcomponent.getSelectionColor() return wrong color. So how can i get the correct highlight color? please see attachment.
thans
from Peter

Back to top
mcheung63



Joined: 18 Dec 2014
Posts: 146
Location: Hong Kong

PostPosted: Mon Mar 20, 2017 4:17 pm    Post subject: Reply with quote

this works:

Code:
FontColorSettings fcs = MimeLookup.getLookup(MimePath.EMPTY).lookup(FontColorSettings.class);
      Coloring c = Coloring.fromAttributeSet(fcs.getFontColors(FontColorNames.CARET_ROW_COLORING));
      g.setColor(c.getBackColor());
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo