我在JFrame中有一个JTabbedPane。我希望它能使边框向右延伸到顶部,左侧和右侧边框上的JFrame边缘。我怎样才能做到这一点?目前在顶部有一个空间,我真的很想摆脱它。有什么想法吗?
以下是目前的示例?
package tapptest;
import java.awt.Dimension;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;
public class Tapptest {
public static void main(String[] args) {
JFrame frame = new JFrame();
JTabbedPane jtp = new JTabbedPane();
jtp.addTab("one", new JLabel("one"));
jtp.addTab("two", new JLabel("two"));
jtp.setPreferredSize(new Dimension(440, 200));
jtp.setTabPlacement(JTabbedPane.BOTTOM);
frame.add(jtp);
frame.setSize(415,180);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setAlwaysOnTop(true);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice defaultScreen = ge.getDefaultScreenDevice();
Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds();
int x = 10;
int y = (int) rect.getMaxY() - (frame.getHeight() + 50);
frame.setLocation(x, y);
frame.setVisible(true);
}
}