本文整理汇总了Java中javax.swing.JPanel.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java JPanel.getWidth方法的具体用法?Java JPanel.getWidth怎么用?Java JPanel.getWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JPanel
的用法示例。
在下文中一共展示了JPanel.getWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createProcParasPane
import javax.swing.JPanel; //导入方法依赖的package包/类
private JPanel createProcParasPane(JPanel parent)
{
JPanel paneProcParas = new JPanel();
paneProcParas.setLayout(null);
paneProcParas.setBorder(BorderFactory.createEtchedBorder());
int nYStartPaneProcParas = m_paneProbability.getHeight() + GuiConstants.GAP_COMPONENT;
paneProcParas.setBounds(0, nYStartPaneProcParas, parent.getWidth(), parent.getHeight() - nYStartPaneProcParas);
LHSListPane scrollParaNames = new LHSListPane(paneProcParas, m_lstProcParaNames);
paneProcParas.add(scrollParaNames);
paneProcParas.add(m_paneParaDistribution);
int nXStartParaDistribution = scrollParaNames.getWidth() + GuiConstants.GAP_COMPONENT;
int nWidthParaDistribution = paneProcParas.getWidth() - nXStartParaDistribution - GuiConstants.GAP_COMPONENT;
int nHeightParaDistribution = scrollParaNames.getHeight() - 2 * GuiConstants.GAP_COMPONENT;
m_paneParaDistribution.setBounds(nXStartParaDistribution, GuiConstants.GAP_COMPONENT, nWidthParaDistribution,
nHeightParaDistribution);
m_paneParaDistribution.add(s_paneDummy);
return paneProcParas;
}
示例2: exportToImage
import javax.swing.JPanel; //导入方法依赖的package包/类
public static void exportToImage(String format, JPanel dPanel, String fileName) {
BufferedImage bImg = new BufferedImage(dPanel.getWidth(), dPanel.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D cg = bImg.createGraphics();
dPanel.paintAll(cg);
try {
if (ImageIO.write(bImg, "jpg", new File("./" + fileName + "." + format)))
{
System.out.println("image saved succesfully");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例3: gaze2pix
import javax.swing.JPanel; //导入方法依赖的package包/类
private Point gaze2pix(JPanel pan, Point2D.Float gaze) {
int h=pan.getHeight(), w=pan.getWidth();
// (g+1)/2 ranges 0:1
p2.setLocation((gaze.x + 1) / 2 * w, h-((gaze.y + 1) / 2 * h)); // y starts from top in AWT, so flip y here
return p2;
}