本文整理匯總了Java中java.awt.Container.getHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java Container.getHeight方法的具體用法?Java Container.getHeight怎麽用?Java Container.getHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Container
的用法示例。
在下文中一共展示了Container.getHeight方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: saveGameRecord
import java.awt.Container; //導入方法依賴的package包/類
public void saveGameRecord(JFrame frame, String competidores, PvpScore pvpScore) {
try {
frame.validate();
frame.repaint();
Container c = frame.getContentPane();
c.validate();
c.repaint();
BufferedImage im = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
c.paint(im.getGraphics());
pvpScore.setGameRecord(im);
} catch (Exception ex) {
Logger.getLogger(OthelloTournament.class
.getName()).log(Level.SEVERE, null, ex);
}
}
示例2: layoutContainer
import java.awt.Container; //導入方法依賴的package包/類
@Override
public void layoutContainer(Container parent) {
Insets insets = parent.getInsets();
int x = insets.left;
int y = insets.top;
int columnWidth = 0;
int limitHeight = parent.getHeight() - insets.bottom;
for (Component c : this.components) {
if (c.isVisible()) {
Dimension d = c.getPreferredSize();
columnWidth = Math.max(columnWidth, d.width);
if (y + d.height >= limitHeight) {
x += columnWidth + this.hgap;
y = insets.top;
}
c.setBounds(x, y, d.width, d.height);
y += d.height + this.vgap;
}
}
}
示例3: layoutContainer
import java.awt.Container; //導入方法依賴的package包/類
@Override
public void layoutContainer(Container parent) {
Insets in = parent.getInsets();
int maxWidth = parent.getWidth() - (in.left + in.right);
int maxHeight = parent.getHeight() - (in.top + in.bottom);
int split;
if (fraction <= 0.0) {
split = 0;
} else if (fraction >= 1.0) {
split = maxWidth;
} else {
split = (int) Math.round(maxHeight * fraction);
split = Math.min(split, maxHeight - comp1.getMinimumSize().height);
split = Math.max(split, comp0.getMinimumSize().height);
}
comp0.setBounds(in.left, in.top, maxWidth, split);
comp1.setBounds(in.left, in.top + split, maxWidth, maxHeight - split);
dragbar.setBounds(in.left, in.top + split - DRAG_TOLERANCE, maxWidth, 2 * DRAG_TOLERANCE);
}
示例4: layoutContainer
import java.awt.Container; //導入方法依賴的package包/類
@Override
public void layoutContainer(Container parent) {
Insets in = parent.getInsets();
int maxWidth = parent.getWidth() - (in.left + in.right);
int maxHeight = parent.getHeight() - (in.top + in.bottom);
int split;
if (fraction <= 0.0) {
split = 0;
} else if (fraction >= 1.0) {
split = maxWidth;
} else {
split = (int) Math.round(maxWidth * fraction);
split = Math.min(split, maxWidth - comp1.getMinimumSize().width);
split = Math.max(split, comp0.getMinimumSize().width);
}
comp0.setBounds(in.left, in.top, split, maxHeight);
comp1.setBounds(in.left + split, in.top, maxWidth - split, maxHeight);
dragbar.setBounds(in.left + split - HorizontalSplitPane.DRAG_TOLERANCE, in.top,
2 * HorizontalSplitPane.DRAG_TOLERANCE, maxHeight);
}
示例5: layoutContainer
import java.awt.Container; //導入方法依賴的package包/類
public void layoutContainer(final Container parent) {
final Insets insets = parent.getInsets();
int posX = insets.left;
final int posY = insets.top;
final int height = parent.getHeight() - insets.top - insets.bottom;
for (Component comp : parent.getComponents()) {
if (comp.isVisible()) {
Dimension pref = comp.getPreferredSize();
if (proportionalHeight) {
int h = Math.min(pref.height, height);
int o = (height - h) / 2;
comp.setBounds(posX, posY + o, pref.width, h);
} else {
comp.setBounds(posX, posY, pref.width, height);
}
posX += hGap;
posX += pref.width;
}
}
}
示例6: layoutContainer
import java.awt.Container; //導入方法依賴的package包/類
@Override
public void layoutContainer(Container parent) {
int x = 0;
int y = 0;
int cellWidth = getMaxCellWidth();
for (Component c : this.components) {
if (c.isVisible()) {
Dimension d = c.getPreferredSize();
if (y + d.height > parent.getHeight()) {
x += cellWidth;
y = 0;
}
c.setBounds(x + 1, y + 1, cellWidth, d.height);
y += d.height;
}
}
}
示例7: layoutContainer
import java.awt.Container; //導入方法依賴的package包/類
/**
* Lays out the specified container.
*
* @param parent the container to be laid out
* @throws IllegalStateException if any of the components added to
* this layout are not in both a horizontal and vertical group
*/
public void layoutContainer(Container parent) {
// Step 1: Prepare for layout.
prepare(SPECIFIC_SIZE);
Insets insets = parent.getInsets();
int width = parent.getWidth() - insets.left - insets.right;
int height = parent.getHeight() - insets.top - insets.bottom;
boolean ltr = isLeftToRight();
if (getAutoCreateGaps() || getAutoCreateContainerGaps() ||
hasPreferredPaddingSprings) {
// Step 2: Calculate autopadding springs
calculateAutopadding(horizontalGroup, HORIZONTAL, SPECIFIC_SIZE, 0,
width);
calculateAutopadding(verticalGroup, VERTICAL, SPECIFIC_SIZE, 0,
height);
}
// Step 3: set the size of the groups.
horizontalGroup.setSize(HORIZONTAL, 0, width);
verticalGroup.setSize(VERTICAL, 0, height);
// Step 4: apply the size to the components.
for (ComponentInfo info : componentInfos.values()) {
info.setBounds(insets, width, ltr);
}
}
示例8: createRawTable
import java.awt.Container; //導入方法依賴的package包/類
public static JTable createRawTable(TableModel model)
{
JTable table = new JTable(model)
{
@Override
public boolean getScrollableTracksViewportHeight()
{
// fetch the table's parent
Container viewport = getParent();
// if the parent is not a viewport, calling this isn't useful
if( !(viewport instanceof JViewport) )
{
return false;
}
// return true if the table's preferred height is smaller
// than the viewport height, else false
return getPreferredSize().height < viewport.getHeight();
}
};
return table;
}
示例9: getScrollableTracksViewportHeight
import java.awt.Container; //導入方法依賴的package包/類
@Override
public boolean getScrollableTracksViewportHeight() {
Container parent = SwingUtilities.getUnwrappedParent(this);
if (parent instanceof JViewport) {
return parent.getHeight() > getPreferredSize().height;
}
return false;
}
示例10: layoutContainer
import java.awt.Container; //導入方法依賴的package包/類
/**
* Lays out the specified container.
*
* @param parent the container to be laid out
* @throws IllegalStateException if any of the components added to
* this layout are not in both a horizontal and vertical group
*/
public void layoutContainer(Container parent) {
// Step 1: Prepare for layout.
prepare(SPECIFIC_SIZE);
Insets insets = parent.getInsets();
int width = parent.getWidth() - insets.left - insets.right;
int height = parent.getHeight() - insets.top - insets.bottom;
boolean ltr = isLeftToRight();
if (getAutocreateGaps() || getAutocreateContainerGaps() ||
hasPreferredPaddingSprings) {
// Step 2: Calculate autopadding springs
calculateAutopadding(horizontalGroup, HORIZONTAL, SPECIFIC_SIZE, 0,
width);
calculateAutopadding(verticalGroup, VERTICAL, SPECIFIC_SIZE, 0,
height);
}
// Step 3: set the size of the groups.
horizontalGroup.setSize(HORIZONTAL, 0, width);
verticalGroup.setSize(VERTICAL, 0, height);
// Step 4: apply the size to the components.
Iterator componentInfo = componentInfos.values().iterator();
while (componentInfo.hasNext()) {
ComponentInfo info = (ComponentInfo)componentInfo.next();
Component c = info.getComponent();
info.setBounds(insets, width, ltr);
}
}
示例11: getScrollableTracksViewportHeight
import java.awt.Container; //導入方法依賴的package包/類
/**
* Track parent viewport's size if it's larger than the current preferred
* height of the table (causes empty tables to fill in the whole area of
* a JScrollPane).
* @return true if the preferred height of the table is smaller than the
* viewport.
*/
@Override
public boolean getScrollableTracksViewportHeight() {
Container parent = getParent();
Dimension dim = getPreferredSize();
return (parent != null && dim!= null &&
parent instanceof JViewport &&
parent.getHeight() > getPreferredSize().height);
}
示例12: UpperPane
import java.awt.Container; //導入方法依賴的package包/類
public UpperPane(Container paneParent)
{
setLayout(LAYOUT);
int nWidth = paneParent.getWidth();
int nHeight = (int) ((double) paneParent.getHeight() * 0.065);
setSize(nWidth, nHeight);
}
示例13: saveFinal
import java.awt.Container; //導入方法依賴的package包/類
public void saveFinal(JPanel panel, String jogoNro) {
try {
panel.validate();
panel.repaint();
panel.validate();
panel.repaint();
Container c = panel;
BufferedImage im = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
c.paint(im.getGraphics());
ImageIO.write(im, "PNG", new File(PATH + File.separator + "jogo" + jogoNro + ".png"));
} catch (IOException ex) {
Logger.getLogger(OthelloTournament.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例14: layoutContainer
import java.awt.Container; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
public void layoutContainer(Container parent) {
Insets insets = parent.getInsets();
int maxWidth = parent.getWidth() - (insets.left + insets.right);
int maxHeight = parent.getHeight() - (insets.top + insets.bottom);
int width = 0;
int height = 0;
width = ((maxWidth - gap * (MAX_COLUMNS + 1)) / MAX_COLUMNS);
height = ((maxHeight - gap * (MAX_ROWS + 1)) / MAX_ROWS);
componentDimension = new Dimension(width, height);
for (Component comp : parent.getComponents()) {
RCPosition position = components.get(comp);
int row = position.getRow();
int column = position.getColumn();
if (position != null) {
int x = insets.left + column * gap + (column - 1)
* componentDimension.width;
int y = insets.top + row * gap + (row - 1)
* componentDimension.height;
if (row == 1 && column == 1) {
comp.setBounds(x, y,
componentDimension.width * 5 + 4 * gap,
componentDimension.height);
} else {
comp.setBounds(x, y, componentDimension.width,
componentDimension.height);
}
}
}
}
示例15: layoutContainer
import java.awt.Container; //導入方法依賴的package包/類
/**
* Description of the Method
*
* @param target Description of Parameter
*/
public void layoutContainer(Container target) {
synchronized (target.getTreeLock()) {
Insets insets = target.getInsets();
int maxheight = target.getHeight() - (insets.top + insets.bottom);// + _vgap * 2);
int nmembers = target.getComponentCount();
int y = 0;
Dimension preferredSize = preferredLayoutSize(target);
Dimension targetSize = target.getSize();
switch (_valign) {
case TOP:
y = insets.top;
break;
case CENTER:
y = (targetSize.height - preferredSize.height) / 2;
break;
case BOTTOM:
y = targetSize.height - preferredSize.height - insets.bottom;
break;
}
for (int i = 0; i < nmembers; i++) {
Component m = target.getComponent(i);
if (m.isVisible()) {
Dimension d = m.getPreferredSize();
m.setSize(d.width, d.height);
if ((y + d.height) <= maxheight) {
if (y > 0) {
y += _vgap;
}
int x = 0;
switch (_halign) {
case LEFT:
x = insets.left;
break;
case CENTER:
x = (targetSize.width - d.width) / 2;
break;
case RIGHT:
x = targetSize.width - d.width - insets.right;
break;
}
m.setLocation(x, y);
y += d.getHeight();
} else {
break;
}
}
}
}
}