本文整理匯總了Java中javax.swing.JComponent.repaint方法的典型用法代碼示例。如果您正苦於以下問題:Java JComponent.repaint方法的具體用法?Java JComponent.repaint怎麽用?Java JComponent.repaint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.repaint方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: refreshMenu
import javax.swing.JComponent; //導入方法依賴的package包/類
private void refreshMenu() {
if (menuItems != null && menuItems.length > 0) {
firstIndex = Math.max(topFixedCount, firstIndex);
firstIndex = Math.min(menuItems.length - bottomFixedCount - scrollCount, firstIndex);
upItem.setEnabled(firstIndex > topFixedCount);
downItem.setEnabled(firstIndex + scrollCount < menuItems.length - bottomFixedCount);
menu.removeAll();
for (int i = 0; i < topFixedCount; i++) {
menu.add(menuItems[i]);
}
if (topFixedCount > 0) {
menu.addSeparator();
}
menu.add(upItem);
for (int i = firstIndex; i < scrollCount + firstIndex; i++) {
menu.add(menuItems[i]);
}
menu.add(downItem);
if (bottomFixedCount > 0) {
menu.addSeparator();
}
for (int i = menuItems.length - bottomFixedCount; i < menuItems.length; i++) {
menu.add(menuItems[i]);
}
JComponent parent = (JComponent) upItem.getParent();
parent.revalidate();
parent.repaint();
}
}
示例2: mousePressed
import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public synchronized void mousePressed(MouseEvent e)
{
JComponent c = (JComponent) e.getComponent();
if( c.isEnabled() )
{
c.setForeground(mTextPressed);
c.setBackground(mBackgroundPressed);
c.repaint();
}
}
示例3: mouseReleased
import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public synchronized void mouseReleased(MouseEvent e)
{
JComponent c = (JComponent) e.getComponent();
c.setForeground(mTextNormal);
c.setBackground(mBackgroundNormal);
c.repaint();
}
示例4: mouseEntered
import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public synchronized void mouseEntered(MouseEvent e)
{
JComponent c = (JComponent) e.getComponent();
if( c.isEnabled() )
{
c.setForeground(mTextActive);
c.setBackground(mBackgroundActive);
c.repaint();
}
}
示例5: mouseExited
import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public synchronized void mouseExited(MouseEvent e)
{
JComponent c = (JComponent) e.getComponent();
c.setForeground(mTextNormal);
c.setBackground(mBackgroundNormal);
c.repaint();
}
示例6: refreshMenu
import javax.swing.JComponent; //導入方法依賴的package包/類
private void refreshMenu() {
if (menuItems != null && menuItems.length > 0) {
firstIndex = Math.max(topFixedCount, firstIndex);
firstIndex = Math.min(menuItems.length - bottomFixedCount - scrollCount, firstIndex);
upItem.setEnabled(firstIndex > topFixedCount);
downItem.setEnabled(firstIndex + scrollCount < menuItems.length - bottomFixedCount);
menu.removeAll();
for (int i = 0; i < topFixedCount; i++) {
menu.add(menuItems[i]);
}
if (topFixedCount > 0) {
menu.add(new JSeparator());
}
menu.add(upItem);
for (int i = firstIndex; i < scrollCount + firstIndex; i++) {
menu.add(menuItems[i]);
}
menu.add(downItem);
if (bottomFixedCount > 0) {
menu.add(new JSeparator());
}
for (int i = menuItems.length - bottomFixedCount; i < menuItems.length; i++) {
menu.add(menuItems[i]);
}
JComponent parent = (JComponent) upItem.getParent();
parent.revalidate();
parent.repaint();
}
}
示例7: refreshMenu
import javax.swing.JComponent; //導入方法依賴的package包/類
private void refreshMenu() {
if (menuItems != null && menuItems.length > 0) {
firstIndex = Math.max(topFixedCount, firstIndex);
firstIndex = Math.min(menuItems.length - bottomFixedCount - scrollCount, firstIndex);
upItem.setEnabled(firstIndex > topFixedCount);
downItem.setEnabled(firstIndex + scrollCount < menuItems.length - bottomFixedCount);
menu.removeAll();
for (int i = 0; i < topFixedCount; i++) {
menu.add(menuItems[i]);
}
if (topFixedCount > 0) {
menu.addSeparator();
}
menu.add(upItem);
for (int i = firstIndex; i < scrollCount + firstIndex; i++) {
menu.add(menuItems[i]);
}
menu.add(downItem);
if (bottomFixedCount > 0) {
menu.addSeparator();
}
for (int i = menuItems.length - bottomFixedCount; i < menuItems.length; i++) {
menu.add(menuItems[i]);
}
JComponent parent = (JComponent) upItem.getParent();
parent.revalidate();
parent.repaint();
}
}
示例8: repaint
import javax.swing.JComponent; //導入方法依賴的package包/類
public static void repaint(JComponent component, Rectangle2D r) {
component.repaint((int)r.getX(), (int)r.getY(), (int)r.getWidth(), (int)r.getHeight());
}