本文整理了Java中ij.gui.GUI
类的一些代码示例,展示了GUI
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GUI
类的具体详情如下:
包路径:ij.gui.GUI
类名称:GUI
[英]This class consists of static GUI utility methods.
[中]此类由静态GUI实用程序方法组成。
代码示例来源:origin: sc.fiji/TrakEM2_
public void run() {
ij.gui.GUI.center(search_frame);
search_frame.setVisible(true);
}
});
代码示例来源:origin: imagej/ImageJA
int getFontHeight() {
Image img = GUI.createBlankImage(64, 64); //dummy version to get fontHeight
Graphics g = img.getGraphics();
int fontType = boldText?Font.BOLD:Font.PLAIN;
Font font = new Font("SansSerif", fontType, (int) (fontSize*zoom) );
FontMetrics metrics = g.getFontMetrics(font);
return metrics.getHeight();
}
代码示例来源:origin: net.imagej/ij
public static Rectangle getZeroBasedMaxBounds() {
if (maxBounds==null)
getMaxWindowBounds();
//if (IJ.debugMode) IJ.log("GUI.getZeroBasedMaxBounds: "+zeroBasedMaxBounds);
return zeroBasedMaxBounds;
}
代码示例来源:origin: net.imagej/ij
public static Rectangle getMaxWindowBounds() {
if (GraphicsEnvironment.isHeadless())
return new Rectangle(0,0,0,0);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
Rectangle bounds = ge.getMaximumWindowBounds();
if (IJ.isLinux() && unionOfBounds==null)
unionOfBounds = getUnionOfBounds(ge);
zeroBasedMaxBounds = null;
if (bounds.x>300 || bounds.equals(unionOfBounds))
bounds = getZeroBasedMonitor(ge, bounds);
if (bounds.x<0 || bounds.x>300 || bounds.width<300) {
Dimension screen = getScreenSize();
bounds = new Rectangle(0, 0, screen.width, screen.height);
}
if (IJ.debugMode) IJ.log("GUI.getMaxWindowBounds: "+bounds);
maxBounds = bounds;
return bounds;
}
代码示例来源:origin: imagej/ImageJA
public static Rectangle getMaxWindowBounds() {
if (GraphicsEnvironment.isHeadless())
return new Rectangle(0,0,0,0);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
Rectangle bounds = ge.getMaximumWindowBounds();
if (IJ.isLinux() && unionOfBounds==null)
unionOfBounds = getUnionOfBounds(ge);
zeroBasedMaxBounds = null;
if (bounds.x>300 || bounds.equals(unionOfBounds))
bounds = getZeroBasedMonitor(ge, bounds);
if (bounds.x<0 || bounds.x>300 || bounds.width<300) {
Dimension screen = getScreenSize();
bounds = new Rectangle(0, 0, screen.width, screen.height);
}
if (IJ.debugMode) IJ.log("GUI.getMaxWindowBounds: "+bounds);
maxBounds = bounds;
return bounds;
}
代码示例来源:origin: sc.fiji/Simple_Neurite_Tracer
public GraphFrame(final JFreeChart chart, final String suggestedSuffix) {
super();
this.suggestedSuffix = suggestedSuffix;
mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
updateWithNewChart(chart, suggestedSuffix, true);
final JPanel buttonsPanel = new JPanel();
exportButton = new JButton("Export graph as SVG");
exportButton.addActionListener(this);
buttonsPanel.add(exportButton);
mainPanel.add(buttonsPanel, BorderLayout.SOUTH);
setContentPane(mainPanel);
validate();
setSize(new java.awt.Dimension(500, 270));
GUI.center(this);
}
代码示例来源:origin: net.imagej/ij
int getFontHeight() {
Image img = GUI.createBlankImage(64, 64); //dummy version to get fontHeight
Graphics g = img.getGraphics();
int fontType = boldText?Font.BOLD:Font.PLAIN;
Font font = new Font("SansSerif", fontType, (int) (fontSize*zoom) );
FontMetrics metrics = g.getFontMetrics(font);
return metrics.getHeight();
}
代码示例来源:origin: net.imagej/ij
public static Rectangle getUnionOfBounds() {
if (unionOfBounds==null)
getMaxWindowBounds();
return unionOfBounds;
}
代码示例来源:origin: sc.fiji/TrakEM2_
ij.gui.GUI.center(frame);
frame.setVisible(true);
}};
代码示例来源:origin: sc.fiji/Image_5D
public ChannelColorCanvas(final ChannelColorChooser cColorChooser) {
super();
this.cColorChooser = cColorChooser;
setForeground(Color.black);
setBackground(Color.white);
cpWidth = cpRectWidth * cpNSats;
cpHeight = cpRectHeight * cpNHues;
canvasWidth = lutWidth + 2 + hSpacer + cpWidth + 2;
canvasHeight = cpHeight + 2 + vSpacer + commonsHeight;
setSize(canvasWidth, canvasHeight);
// lutImage = new BufferedImage(lutWidth+2, lutHeight+2, BufferedImage.TYPE_INT_RGB);
// colorPickerImage = new BufferedImage(cpWidth+2, cpHeight+2, BufferedImage.TYPE_INT_RGB);
lutImage = GUI.createBlankImage(lutWidth + 2, lutHeight + 2);
colorPickerImage = GUI.createBlankImage(cpWidth + 2, cpHeight + 2);
// commonsImage = new BufferedImage(commonsWidth, commonsHeight, BufferedImage.TYPE_INT_RGB);
drawLUT();
drawColorPicker();
// drawCommons();
addMouseListener(this);
}
代码示例来源:origin: imagej/ImageJA
public static Rectangle getZeroBasedMaxBounds() {
if (maxBounds==null)
getMaxWindowBounds();
//if (IJ.debugMode) IJ.log("GUI.getZeroBasedMaxBounds: "+zeroBasedMaxBounds);
return zeroBasedMaxBounds;
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
public GraphFrame(
final TimePoints timepoints,
final JFreeChart chart,
final int referenceTimePoint,
final boolean enableReferenceTimePoint,
final List< SelectTimepointEntry > extraMenuItems,
final ArrayList< RegistrationStatistics > data )
{
super();
mainPanel = new JPanel();
mainPanel.setLayout( new BorderLayout() );
updateWithNewChart( timepoints, chart, true, extraMenuItems, data, referenceTimePoint, enableReferenceTimePoint );
JPanel buttonsPanel = new JPanel();
mainPanel.add( buttonsPanel, BorderLayout.SOUTH );
setContentPane( mainPanel );
validate();
GUI.center( this );
}
代码示例来源:origin: sc.fiji/FlowJ_
private void doGraph()
{
if (flow instanceof FlowJFlow && trueFlow instanceof FlowJFlow)
{
ImagePlus imp = new ImagePlus("True-Estimate "+description,
GUI.createBlankImage(300,300));
ImageWindow imw = new ImageWindow(imp);
imp.show();
Image img = imp.getImage();
FlowJError.map(img.getGraphics(), 300, 300, flow, trueFlow);
}
else
IJ.error("flow or true flow not known");
}
/**
代码示例来源:origin: imagej/ImageJA
public static Rectangle getUnionOfBounds() {
if (unionOfBounds==null)
getMaxWindowBounds();
return unionOfBounds;
}
代码示例来源:origin: sc.fiji/TrakEM2_
Utils.invokeLater(new Runnable() { public void run() {
min_max.set(minslider.getValue(), maxslider.getValue());
frame.pack();
// after calling pack
Dimension dim = new Dimension(plot.getWidth(), 15);
minslider.setMinimumSize(dim);
maxslider.setMinimumSize(dim);
frame.pack(); // again
ij.gui.GUI.center(frame);
frame.setAlwaysOnTop(true);
frame.setVisible(true);
ContrastAdjustmentMode.super.initThreads();
}});
}
代码示例来源:origin: net.imagej/ij
Image img = GUI.createBlankImage(128, 64);
Graphics g = img.getGraphics();
FontMetrics metrics = g.getFontMetrics(font);
代码示例来源:origin: net.imagej/ij
/** Called once when ImageJ quits. */
public void savePreferences(Properties prefs) {
Point loc = getLocation();
if (IJ.isLinux()) {
Rectangle bounds = GUI.getMaxWindowBounds();
loc.y = bounds.y;
}
prefs.put(IJ_X, Integer.toString(loc.x));
prefs.put(IJ_Y, Integer.toString(loc.y));
}
代码示例来源:origin: sc.fiji/3D_Viewer
@Override
public void run(final String arg) {
final ImagePlus image = WindowManager.getCurrentImage();
try {
final Image3DUniverse univ = new Image3DUniverse();
univ.show();
GUI.center(univ.getWindow());
if (arg != null && !arg.equals("")) importContent(arg);
// only when there is an image and we are not called
// from a macro
else if (image != null && !IJ.isMacro()) univ.getExecuter().addContent(
image, null);
}
catch (final Exception e) {
final StringBuffer buf = new StringBuffer();
final StackTraceElement[] st = e.getStackTrace();
buf.append("An unexpected exception occurred. \n"
+ "Please mail me the following lines if you \n" + "need help.\n"
+ "bene.schmid@gmail.com\n \n");
buf.append(e.getClass().getName() + ":" + e.getMessage() + "\n");
for (int i = 0; i < st.length; i++) {
buf.append(" at " + st[i].getClassName() + "." +
st[i].getMethodName() + "(" + st[i].getFileName() + ":" +
st[i].getLineNumber() + ")\n");
}
new ij.text.TextWindow("Error", buf.toString(), 500, 400);
}
}
代码示例来源:origin: imagej/ImageJA
Image img = GUI.createBlankImage(128, 64);
Graphics g = img.getGraphics();
FontMetrics metrics = g.getFontMetrics(font);
代码示例来源:origin: imagej/ImageJA
/** Called once when ImageJ quits. */
public void savePreferences(Properties prefs) {
Point loc = getLocation();
if (IJ.isLinux()) {
Rectangle bounds = GUI.getMaxWindowBounds();
loc.y = bounds.y;
}
prefs.put(IJ_X, Integer.toString(loc.x));
prefs.put(IJ_Y, Integer.toString(loc.y));
}
内容来源于网络,如有侵权,请联系作者删除!