English 中文(简体)
2. 计算小数以补足父母的胎数
原标题:Set the JPanel size to fill parent with little margin

我有两个Jpanel(JpanelLeftJpanelLeftContent)可以如何使JpanelLeftContent在左边稍有余地地补足父母。 i) 尝试了不同的布局,试图改变飞跃和飞跃的价值,但都没有给我带来良好结果。

  JPanel JpanelLeft = new JPanel();
  JPanel JpanelLeftContent = new JPanel();
  JpanelLeft.add(JpanelLeftContent);

如果可能的话,如何让JpanelLeftContent像画面所示的四舍五入。

“entergraph

最佳回答
问题回答

尝试这个法典的例子:

import java.awt.*;
import javax.swing.*;

public class InsetTesting extends JFrame
{
    private void createAndDisplayGUI()
    {
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setLocationByPlatform(true);

        JPanel contentPane = new JPanel();
        contentPane.setOpaque(true);
        contentPane.setBorder(BorderFactory.createLineBorder(
                                    Color.DARK_GRAY.darker(), 5, true));
        contentPane.setBackground(Color.WHITE);

        add(contentPane, BorderLayout.CENTER);
        pack();
        setVisible(true);
    }

    public Insets getInsets()
    {
        return (new Insets(30, 20, 10, 20));
    }

    public Dimension getPreferredSize()
    {
        return (new Dimension(200, 400));
    }

    public static void main(Stringu005Bu005D args)
    {
        SwingUtilities.invokeLater(new Runnable()
        {
            public void run()
            {
                new InsetTesting().createAndDisplayGUI();
            }
        });
    }
}

这里的产出如下:

“INSETS”/

To make a JPanel appear rounded, you need to make your own class that extends JPanel, override paintComponent and draw the panel as an ellipse Javadoc here This will create a customized object which is an JPanel.

当你具体说明贵方略号时,你想从上级小组获得Y和X值(因为你会增加你对另一个小组的长篇大论),然后从X-轴心中删除你希望的颜色。 可以通过将这些价值观传给“智者小组”构造者来实现。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签