Solved

Java - Transparent JScrollPane

Posted on 2010-08-18
7
813 Views
Last Modified: 2012-06-21
I have a JTextArea and it's riding ontop of a JScrollPane. Anyways, I know I can use the `getViewPort()` method to set the opaque of of the view port... but I cannot seem to find any sign of how to do that... anywhere. :S

Here is what I have so far:
     if (e.getKeyCode() == KeyEvent.VK_F)
    {
    	if (sp.isVisible())
    	{
    		sp.setVisible(false);
    	}
    	else
    	{
    		sp.setVisible(true);
    	}
    }

Open in new window

0
Comment
Question by:UrbanTwitch
  • 4
  • 3
7 Comments
 
LVL 92

Expert Comment

by:objects
ID: 33470956
what is it you want to achieve?
0
 
LVL 5

Author Comment

by:UrbanTwitch
ID: 33470973
Make the JTextArea transparent ... like 50%? make it see through.
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 33471017
textarea.setOpaque(false);
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 5

Author Comment

by:UrbanTwitch
ID: 33471125
That clears it ALL THE way off. Can't I have it 50% see through? like.. opacity?
0
 
LVL 5

Author Comment

by:UrbanTwitch
ID: 33471132
Maybe I can set the background of a JScrollPane to a .gif image which is 50% transparent?
0
 
LVL 92

Expert Comment

by:objects
ID: 33471154
try this:

textarea.setBackground(new Color(r,g, b, 127));
0
 
LVL 5

Author Comment

by:UrbanTwitch
ID: 33471168
I'm guessing r,g,b is an int ... should be like:
c.setBackground(new Color(255,255,255, 127));
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now