Solved

Java - Transparent JScrollPane

Posted on 2010-08-18
7
833 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 115
servlet doXXX methods 3 49
HTTPSessionBindingListernter not configured in deployment descriptor 2 52
Configure a Bean in an XML file 4 31
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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 “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

776 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