我在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);
}
}
暂无答案!
目前还没有任何答案,快来回答吧!