本文整理匯總了Java中javax.swing.JProgressBar.HORIZONTAL屬性的典型用法代碼示例。如果您正苦於以下問題:Java JProgressBar.HORIZONTAL屬性的具體用法?Java JProgressBar.HORIZONTAL怎麽用?Java JProgressBar.HORIZONTAL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.swing.JProgressBar
的用法示例。
在下文中一共展示了JProgressBar.HORIZONTAL屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: paintDeterminate
@Override
protected void paintDeterminate(Graphics g, JComponent c) {
Insets b = progressBar.getInsets(); // area for border
int barRectWidth = progressBar.getWidth() - (b.right + b.left);
int barRectHeight = progressBar.getHeight() - (b.top + b.bottom);
if (barRectWidth <= 0 || barRectHeight <= 0) {
return;
}
// amount of progress to draw
int amountFull = getAmountFull(b, barRectWidth, barRectHeight);
Graphics2D g2 = (Graphics2D) g;
g2.setColor(progressBar.getForeground());
if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) {
g2.setPaint(high);
g2.fillRect(0, 0, amountFull, c.getHeight() / 2);
g2.setPaint(low);
g2.fillRect(0, c.getHeight() / 2, amountFull, c.getHeight());
} else { // VERTICAL
}
// Deal with possible text painting
if (progressBar.isStringPainted()) {
paintString(g, b.left, b.top, barRectWidth, barRectHeight,
amountFull, b);
}
}