1 Attachment(s)
removing the small arrow of Synth L&F JInternalFrame title bar (Nimbus)
im diving around google looking how to remove the small arrow of a JInternalFrame set up with a Synth(Nimbus) Look and Feel
with a Default L&F
this code removes some of property of a JInternalFrame object, leaving only the close button
Code :
internalFrame.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
but switching the lookAndFeel of the components using this code, a Synth Style internal frame has a default behavior that retains a small arrow button, a Simple png image is attached, to see what it looks like
Code :
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
whole code for the program
Code :
import java.beans.PropertyVetoException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JInternalFrame;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Color;
import java.awt.Point;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import javax.swing.plaf.InternalFrameUI;
import javax.swing.plaf.synth.SynthInternalFrameUI;
public class Window {
public Window() {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
setUp();
}
public void setUp() {
JFrame f = new JFrame();
JPanel p = new JPanel(null);
JInternalFrame internalFrame = new JInternalFrame();
internalFrame.setSize(200, 150);
internalFrame.setOpaque(true);
internalFrame.setLocation(new Point(50 ,2));
internalFrame.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
internalFrame.setClosable(true);
internalFrame.setResizable(true);
internalFrame.setVisible(true);
p.add(internalFrame);
p.setBackground(Color.BLACK);
f.add(internalFrame);
f.getContentPane().add(p);
f.setSize(400, 200);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
public static void main(String[] args) {
new Window();
}
}
until i found this thread on another forum, having the same problem with that arrow
java - Is it possible to remove the little dropdown arrow in a JInternalFrame? - Stack Overflow
pointing out this thing
Quote:
InternalFrame:InternalFrameTitlePane:"InternalFram eTitlePane.menuButton".icon
questions:
1.) is there a (maybe not an Easy way) but a considerable approach to JUST REMOVE that small arrow button of a Synth Look and Feel Internal frame?
2.) i ended up on BasicInternalFrameUI, InternalFrameUI, SynthInternalFrameUI classes, where or which of these classes should i focus on to deal with this problem?
3.) how to use this classes?, google resources gives me tons of confusing codes,
i need some guides and maybe some idea, for this one