📄 xjpanel1.java
字号:
/*
* OPIAM Suite
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package opiam.admin.faare.service.services.views.orgchart;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JPanel;
/**
* Panel representing space between cells in "condensed" representation.
*
*/
public class XJPanel1 extends JPanel
{
/** Panel size. */
private int size;
/**
* Creates a new XJPanel1 object.
*
* @param asize Size of panel.
*/
public XJPanel1(final int asize)
{
this.size = asize;
}
/**
* Gets minimum size of the component.
*
* @return The minimum size according to panel size and orgchart mode.
*/
public final Dimension getMinimumSize()
{
if (OrgChartPanel.getDirection() == OrgChartPanel.HORIZONTAL)
{
return new Dimension(size, 0);
}
else
{
return new Dimension(0, size);
}
}
/**
* Gets preferred size of the component.
*
* @return The preferred size according to panel size and orgchart mode.
*/
public final Dimension getPreferredSize()
{
if (OrgChartPanel.getDirection() == OrgChartPanel.HORIZONTAL)
{
return new Dimension(size, 0);
}
else
{
return new Dimension(0, size);
}
}
/**
* Gets maximum size of the component.
*
* @return The maximum size according to panel size and orgchart mode.
*/
public final Dimension getMaximumSize()
{
if (OrgChartPanel.getDirection() == OrgChartPanel.HORIZONTAL)
{
return new Dimension(size, Integer.MAX_VALUE);
}
else
{
return new Dimension(Integer.MAX_VALUE, size);
}
}
/**
* Draws the component.
*
* @param g Graphics on which to draw.
*/
public final void paint(final Graphics g)
{
super.paint(g);
if (OrgChartPanel.getDirection() == OrgChartPanel.HORIZONTAL)
{
g.drawLine(0, 0, getWidth(), 0);
g.drawLine(0, 1, getWidth(), 1);
}
else
{
g.drawLine(0, 0, 0, getHeight());
g.drawLine(1, 0, 1, getHeight());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -