本文整理匯總了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;
}