Creating a transparent panel
I need to create a panel which should be invisible but the components inside it (for example, JTextArea, JButton, etc.) should be visible. When I click on the invisible panel, it should become visible.
I can only use JRE 1.4 and nothing more than that. :(
Any idea how to create such a transparent panel???
Asked by: Miranda285 | Posted: 21-01-2022
Answer 1
Transparancy is controlled with
setOpaque(false)
Answered by: First Name137 | Posted: 22-02-2022
Answer 2
JComponent.setOpaque(false)
is the way to go.
Similar questions
java - Creating a transparent PNG using an FBO creates an empty image
I'm making a Minecraft mod where i'm trying to render all the icons of blocks to a transparent PNG-image. This is my first time using OpenGL and I just can't find the issue I'm having: the output is just a transparent PNG-image with nothing in it.
Note that Minecraft also works with a framebuffer.
In the start, this part of the code creates the framebuffer, depthbuffer and texture.
/...
java - Creating a control seems to break transparent stages on JFX8
The above program should create a transparent stage with some text, but the stage appears opaque:
public class Test extends Application {
@Override
public void start(Stage primaryStage) {
new TextArea(); //Comment this out to enable transparency
Stage stage = new Stage();
stage.initStyle(StageStyle.TRANSPARENT);
Text text = new Text("Is this transparent?");
VBox box = new VBox(...
java - Creating new Transparent Stage on Event JavaFX
I'm trying to create a new Stage when a button is pressed.
It works but the problem is that I'd like this Stage to be fully transparent and lets us see what's behind the screen.
Code
Dimension Sizescreen = Toolkit.getDefaultToolkit().getScreenSize();
//Main stage with option menu
Pane window = new Pane();
Scene scene = new Scene(windo...
swing - JAVA - Creating and showing a transparent window with a button
I'm trying to create a transparent fullscreen overlay with a bunch of buttons.
I've used JFrame to create the overlay, however, but the button does not show.
package com.Flickr.firstApp;
import javax.swing.*;
import java.awt.*;
import java.util.Random;
public class MainClass {
public static void main(String... args) throws Exception {
Robot robot = new Robot();
Random random = n...
java - transparent batching remote calls in dwr
I want DWR to transparently batch all remote calls that are done in the course of handling the same event.
The reason is that handling an event in Javascript must only take a short time and nothing else can happen during the same time. So if I am going to do many calls, I would like to DWR batch them transparenty. Is that possible? How?
java - How to make the background of a JCheckBox transparent?
Is there an easy way to make the background of a JCheckBox transparent? The box itself and the text should both be ordinary colored.
user interface - Java SWT - Text on Transparent Shell?
In Java SWT, is there a way to draw text on a transparent shell so that only the text appears visible? What I would like to do is have the text appear on my desktop without any background window. Using shell.setAlpha() will make the entire shell transparent, including any elements that appear on it (which I am trying to avoid).
java - What is the easiest / most transparent way of caching methods in spring?
If I have a bunch of DAO's with a bunch of getXXX methods and I want all or some explicit list of the methods cached is there any way I can do this transparently with Spring?
What I don't want is:
To change any source code / add
anotations
Manually have to create a number of proxy beans for a number of DAO's and rewire them all.
Ideally something with a regex to match the DAO's...
java - Transparent Swing Windows
I have a little JWindow with a logo on it that users can drag stuff to.
I develop my application mainly on OS X. To get a transparent window i use
setBackground(new Color(0,0,0,0));
On a mac this works beautifully but I can't get the same effect on windows.
Is there any way to get a transparent window without using 1.6 specific features.
I need 1.5 compatibility.
How to draw a transparent plane in Java 3D?
I am trying to draw a transparent plane (X[0..100],Y[0..100],Z=0) in Java 3D, but can't figure out how. I've looked on the tutorial page and still can't find any sample programs.
I am attempting to find a "plane" object as a BranchGroup to add to my existing TransformGroup, but there isn't such a plane object; what should I use? And how do I make it transparent?
graphics - how to make java JPanel and graphics2d transparent?
Well the title is quite self explanatory. I want to build two panels one on-top of each other in layers using java. I want the top layer to contain a JPanel which will contain a graphics2d object. I'd like both the JPanel and graphics2d to have transparent background (I still want the content drawn by the graphics2d visible). Does anyone have an idea how it can be done?
Java <-> Scala interop: transparent List and Map conversion
I am learning Scala and I have a Java project to migrate to Scala. I want to migrate it by rewriting classes one-by-one and checking that new class didn't break the project.
This Java project uses lots of java.util.List and java.util.Map. In new Scala classes I would like to use Scala’s List and Map to have good-looking Scala code.
The problem is that ne...
java - Android Spinner - How to make dropdown view transparent?
I have a custom spinner dropdown xml file in /res/layout/:
spinner_view_dropdown.xml:
<?xml version="1.0" encoding="UTF-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/spinner_item_dropdown"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent"
style="@style/spinner_item_dropdown" />
java - how do I specify a transparent background colour on a draw2d Figure?
I'm writing an eclipse plugin, and I'm layering some simple figures (i.e. view elements) together to create diagrams.
A simple component looks like this
A simple component with rendering issues http://img115.yfrog.com/img115/4946/componentwithopacity.jpg
The drum icon on the right is part of a tiny w...
Still can't find your answer? Check out these amazing Java communities for help...
Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)