本文整理汇总了Java中java.awt.Component.isVisible方法的典型用法代码示例。如果您正苦于以下问题:Java Component.isVisible方法的具体用法?Java Component.isVisible怎么用?Java Component.isVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Component
的用法示例。
在下文中一共展示了Component.isVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addListeners
import java.awt.Component; //导入方法依赖的package包/类
void addListeners(Component ancestor, boolean addToFirst) {
Component a;
firstInvisibleAncestor = null;
for (a = ancestor;
firstInvisibleAncestor == null;
a = a.getParent()) {
if (addToFirst || a != ancestor) {
a.addComponentListener(this);
if (a instanceof JComponent) {
JComponent jAncestor = (JComponent)a;
jAncestor.addPropertyChangeListener(this);
}
}
if (!a.isVisible() || a.getParent() == null || a instanceof Window) {
firstInvisibleAncestor = a;
}
}
if (firstInvisibleAncestor instanceof Window &&
firstInvisibleAncestor.isVisible()) {
firstInvisibleAncestor = null;
}
}
示例2: JPopupWindowFinder
import java.awt.Component; //导入方法依赖的package包/类
/**
* Constructs JPopupWindowFinder.
*
* @param sf searching criteria for a JPopupMenu inside the window..
*/
public JPopupWindowFinder(ComponentChooser sf) {
subFinder = new JPopupMenuFinder(sf);
ppFinder = new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
return (comp.isShowing()
&& comp.isVisible()
&& subFinder.checkComponent(comp));
}
@Override
public String getDescription() {
return subFinder.getDescription();
}
@Override
public String toString() {
return "JPopupMenuOperator.JPopupWindowFinder.ComponentChooser{description = " + getDescription() + '}';
}
};
}
示例3: preferredLayoutSize
import java.awt.Component; //导入方法依赖的package包/类
public Dimension preferredLayoutSize(Container target) {
synchronized (target.getTreeLock()) {
Dimension dim = new Dimension(0, 0);
int nmembers = target.getComponentCount();
for (int i = 0 ; i < nmembers ; i++) {
Component m = target.getComponent(i);
if (m.isVisible()) {
Dimension d = m.getPreferredSize();
dim.width = Math.max(dim.width, d.width);
dim.height += d.height;
}
}
Insets insets = target.getInsets();
dim.width += insets.left + insets.right;
dim.height += insets.top + insets.bottom;
return dim;
}
}
示例4: layoutContainer
import java.awt.Component; //导入方法依赖的package包/类
public void layoutContainer(Container target) {
synchronized (target.getTreeLock()) {
Insets insets = target.getInsets();
int maxwidth = parent.getWidth() - (insets.left + insets.right);
int nmembers = target.getComponentCount();
int x = insets.left, y = insets.top;
for (int i = 0 ; i < nmembers ; i++) {
Component m = target.getComponent(i);
if (m.isVisible()) {
Dimension d = m.getPreferredSize();
m.setSize(maxwidth, d.height);
m.setLocation(x, y);
y += d.height;
}
}
}
}
示例5: handleOverflowAddittion
import java.awt.Component; //导入方法依赖的package包/类
private void handleOverflowAddittion(int visibleButtons) {
Component[] comps = getAllComponents();
removeAll();
overflowToolbar.setOrientation(getOrientation() == HORIZONTAL ? VERTICAL : HORIZONTAL);
popup.removeAll();
for (Component comp : comps) {
if (visibleButtons > 0) {
add(comp);
if (comp.isVisible()) {
visibleButtons--;
}
} else {
overflowToolbar.add(comp);
}
}
popup.add(overflowToolbar);
add(overflowButton);
}
示例6: getPreferredSize
import java.awt.Component; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
Component[] comps = getAllComponents();
Insets insets = getInsets();
int width = null == insets ? 0 : insets.left + insets.right;
int height = null == insets ? 0 : insets.top + insets.bottom;
for (int i = 0; i < comps.length; i++) {
Component comp = comps[i];
if (!comp.isVisible()) {
continue;
}
width += getOrientation() == HORIZONTAL ? comp.getPreferredSize().width : comp.getPreferredSize().height;
height = Math.max( height, (getOrientation() == HORIZONTAL
? (comp.getPreferredSize().height + (insets == null ? 0 : insets.top + insets.bottom))
: (comp.getPreferredSize().width) + (insets == null ? 0 : insets.left + insets.right)));
}
if(overflowToolbar.getComponentCount() > 0) {
width += getOrientation() == HORIZONTAL ? overflowButton.getPreferredSize().width : overflowButton.getPreferredSize().height;
}
Dimension dim = getOrientation() == HORIZONTAL ? new Dimension(width, height) : new Dimension(height, width);
return dim;
}
示例7: minimumLayoutSize
import java.awt.Component; //导入方法依赖的package包/类
public Dimension minimumLayoutSize(final Container parent) {
final Insets insets = parent.getInsets();
final Dimension d = new Dimension(insets.left + insets.right,
insets.top + insets.bottom);
int maxWidth = 0;
int visibleCount = 0;
for (Component comp : parent.getComponents()) {
if (comp.isVisible() && !(comp instanceof Box.Filler)) {
final Dimension size = comp.getPreferredSize();
maxWidth = Math.max(maxWidth, size.width);
d.height += size.height;
visibleCount++;
}
}
d.height += (visibleCount - 1) * vGap;
d.width += maxWidth;
return d;
}
示例8: hasVisibleComponents
import java.awt.Component; //导入方法依赖的package包/类
private boolean hasVisibleComponents() {
for( Component c : getComponents() ) {
if( c instanceof SlideBar )
continue;
if( null != c && c.isVisible() )
return true;
}
return modeContainer.getTopComponents().length > 0;
}
示例9: isGlue
import java.awt.Component; //导入方法依赖的package包/类
private boolean isGlue(Component c) {
if (c.isVisible() && c instanceof Box.Filler) {
Box.Filler f = (Box.Filler)c;
Dimension min = f.getMinimumSize();
Dimension pref = f.getPreferredSize();
return min.width == 0 && min.height == 0 &&
pref.width == 0 && pref.height == 0;
}
return false;
}
示例10: minimumLayoutSize
import java.awt.Component; //导入方法依赖的package包/类
/**
* Description of the Method
*
* @param target
* Description of Parameter
* @return Description of the Returned Value
*/
@Override
public Dimension minimumLayoutSize(Container target){
synchronized(target.getTreeLock()){
Dimension dim=new Dimension(0, 0);
int nmembers=target.getComponentCount();
boolean firstVisibleComponent=true;
for(int ii=0;ii<nmembers;ii++){
Component m=target.getComponent(ii);
if(m.isVisible()){
Dimension d=m.getPreferredSize();
dim.width=Math.max(dim.width, d.width);
if(firstVisibleComponent){
firstVisibleComponent=false;
}else{
dim.height+=_vgap;
}
dim.height+=d.height;
}
}
Insets insets=target.getInsets();
dim.width+=insets.left+insets.right+_hgap*2;
dim.height+=insets.top+insets.bottom+_vgap*2;
return dim;
}
}
示例11: processBindingForKeyStrokeRecursive
import java.awt.Component; //导入方法依赖的package包/类
static boolean processBindingForKeyStrokeRecursive(MenuElement elem,
KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
if (elem == null) {
return false;
}
Component c = elem.getComponent();
if ( !(c.isVisible() || (c instanceof JPopupMenu)) || !c.isEnabled() ) {
return false;
}
if (c != null && c instanceof JComponent &&
((JComponent)c).processKeyBinding(ks, e, condition, pressed)) {
return true;
}
MenuElement[] subElements = elem.getSubElements();
for (MenuElement subElement : subElements) {
if (processBindingForKeyStrokeRecursive(subElement, ks, e, condition, pressed)) {
return true;
// We don't, pass along to children JMenu's
}
}
return false;
}
示例12: isFocusableComponent
import java.awt.Component; //导入方法依赖的package包/类
protected boolean isFocusableComponent(Component component) {
if (!component.isVisible()) return false;
// if (!component.isEnabled()) return false;
if (component instanceof JLabel) return false;
if (component instanceof JPanel) return false;
if (component instanceof JSeparator) return false;
if (component instanceof JToolBar) return false;
if (component instanceof Box.Filler) return false;
return true;
}
示例13: getRowHeights
import java.awt.Component; //导入方法依赖的package包/类
private int[] getRowHeights()
{
int[] rowHeights = new int[componentListByRow.size()];
for(int row = 0; row < componentListByRow.size(); ++row )
{
boolean fillheight = true;
List<Component> components = componentListByRow.get(row);
for( Component comp : components )
{
if( !comp.isVisible() )continue;
SlickConstraint constr = constraintMap.get(comp);
if( constr.vSizing == SlickConstraint.VerticalPack )
{
rowHeights[row] = Math.max( comp.getPreferredSize().height, rowHeights[row]);
fillheight = false;
}
else // use the largest height of vertFill IFF no vertPack exist
{
if( fillheight )
{
rowHeights[row] = Math.max( comp.getPreferredSize().height, rowHeights[row]);
}
}
}
}
return rowHeights;
}
示例14: preferredLayoutSize
import java.awt.Component; //导入方法依赖的package包/类
public Dimension preferredLayoutSize(Container parent) {
Dimension d = new Dimension( 0,0 );
d.height = getPreferredHeight();
for( Component c : getComponents() ) {
if( !c.isVisible() )
continue;
d.width += c.getPreferredSize().width;
}
Insets borderInsets = parent.getInsets();
if( null != borderInsets ) {
d.height += borderInsets.top;
d.height += borderInsets.bottom;
}
return d;
}
示例15: previousEnabledChild
import java.awt.Component; //导入方法依赖的package包/类
private static MenuElement previousEnabledChild(MenuElement e[],
int fromIndex, int toIndex) {
for (int i=fromIndex; i>=toIndex; i--) {
if (e[i] != null) {
Component comp = e[i].getComponent();
if ( comp != null
&& (comp.isEnabled() || UIManager.getBoolean("MenuItem.disabledAreNavigable"))
&& comp.isVisible()) {
return e[i];
}
}
}
return null;
}