I am making an application for my church, and my JLabels have some drop shadows on them, I'm trying to make the background transparent on a windows computer but it's not working. It works perfectly on a Mac, I have tried googling this and using setOpague to false but nothing, suggestions?
Images of the problem: Mac
Code:
//Made by Trey Carey | 6.25.18
//Credit to Daniel Kihlgren for the original idea
//Credit to Kevin Blenman for UI work
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
public class choosingScreen {
static String versionNumber = new String("1.0"); //Version Number
static String applicationName = new String("Lower Thirds SDV " + versionNumber); //Application Name
public static void main(String[] args) throws IOException {
createChoosingWindow();
}
static void createChoosingWindow() throws IOException {
JFrame mainFrame = new JFrame(applicationName);
//Images to Buffer
URL icon = loginScreen.class.getResource("/images/SDV-Icon.png");
JLabel backgroundImage = new JLabel(new ImageIcon(loginScreen.class.getResource("/images/Main_BKG.png")));
JLabel logo = new JLabel(new ImageIcon(loginScreen.class.getResource("/images/POK Logo.png")));
JLabel copyrightImage = new JLabel(new ImageIcon(loginScreen.class.getResource("/images/Copyright.png")));
JLabel lowerThirdsLogo = new JLabel(new ImageIcon(loginScreen.class.getResource("/images/LowerThirds_Logo.png")));
JButton lowerThirdsButton = new JButton(new ImageIcon(loginScreen.class.getResource("/images/Lower Thirds.png")));
JButton lyricsButton = new JButton(new ImageIcon(loginScreen.class.getResource("/images/Lyrics.png")));
BufferedImage iconImage = ImageIO.read(icon);
mainFrame.add(backgroundImage);
backgroundImage.add(lowerThirdsLogo);
lowerThirdsLogo.setSize(lowerThirdsLogo.getPreferredSize());
lowerThirdsLogo.setLocation(150, 20);
backgroundImage.add(logo);
logo.setSize(logo.getPreferredSize());
logo.setLocation(270, 525);
backgroundImage.add(copyrightImage);
copyrightImage.setSize(copyrightImage.getPreferredSize());
copyrightImage.setLocation(600, 550);
backgroundImage.add(lowerThirdsButton);
lowerThirdsButton.setSize(lowerThirdsButton.getPreferredSize());
lowerThirdsButton.setLocation(200, 200);
lowerThirdsButton.setText("");
lowerThirdsButton.setBorder(BorderFactory.createEmptyBorder());
backgroundImage.add(lyricsButton);
lyricsButton.setSize(lyricsButton.getPreferredSize());
lyricsButton.setLocation(200, 300);
lyricsButton.setText("");
lyricsButton.setBorder(BorderFactory.createEmptyBorder());
//LYRICS ACTION LISTENER
lyricsButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO add code for making Lyrics work
}
});
//LOWER THIRDS ACTION LISTENER
lowerThirdsButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
//TODO make code for working lower thirds here
}
});
mainFrame.setResizable(false);
mainFrame.setIconImage(iconImage);
mainFrame.pack();
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setLocationRelativeTo(null);
mainFrame.setVisible(true);
}
}
Here are the images