本文整理汇总了Java中org.jfree.experimental.swt.SWTUtils.toAwtFont方法的典型用法代码示例。如果您正苦于以下问题:Java SWTUtils.toAwtFont方法的具体用法?Java SWTUtils.toAwtFont怎么用?Java SWTUtils.toAwtFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.experimental.swt.SWTUtils
的用法示例。
在下文中一共展示了SWTUtils.toAwtFont方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import org.jfree.experimental.swt.SWTUtils; //导入方法依赖的package包/类
/**
* Creates the chart below the statistics table
*/
private void createChart() {
mAllocCountDataSet = new DefaultCategoryDataset();
mChart = ChartFactory.createBarChart(null, "Size", "Count", mAllocCountDataSet,
PlotOrientation.VERTICAL, false, true, false);
// get the font to make a proper title. We need to convert the swt font,
// into an awt font.
Font f = mStatisticsBase.getFont();
FontData[] fData = f.getFontData();
// event though on Mac OS there could be more than one fontData, we'll only use
// the first one.
FontData firstFontData = fData[0];
java.awt.Font awtFont = SWTUtils.toAwtFont(mStatisticsBase.getDisplay(),
firstFontData, true /* ensureSameSize */);
mChart.setTitle(new TextTitle("Allocation count per size", awtFont));
Plot plot = mChart.getPlot();
if (plot instanceof CategoryPlot) {
// get the plot
CategoryPlot categoryPlot = (CategoryPlot)plot;
// set the domain axis to draw labels that are displayed even with many values.
CategoryAxis domainAxis = categoryPlot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
CategoryItemRenderer renderer = categoryPlot.getRenderer();
renderer.setBaseToolTipGenerator(new CategoryToolTipGenerator() {
@Override
public String generateToolTip(CategoryDataset dataset, int row, int column) {
// get the key for the size of the allocation
ByteLong columnKey = (ByteLong)dataset.getColumnKey(column);
String rowKey = (String)dataset.getRowKey(row);
Number value = dataset.getValue(rowKey, columnKey);
return String.format("%1$d %2$s of %3$d bytes", value.intValue(), rowKey,
columnKey.getValue());
}
});
}
mChartComposite = new ChartComposite(mStatisticsBase, SWT.BORDER, mChart,
ChartComposite.DEFAULT_WIDTH,
ChartComposite.DEFAULT_HEIGHT,
ChartComposite.DEFAULT_MINIMUM_DRAW_WIDTH,
ChartComposite.DEFAULT_MINIMUM_DRAW_HEIGHT,
3000, // max draw width. We don't want it to zoom, so we put a big number
3000, // max draw height. We don't want it to zoom, so we put a big number
true, // off-screen buffer
true, // properties
true, // save
true, // print
false, // zoom
true); // tooltips
mChartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
}
示例2: createCompositeChart
import org.jfree.experimental.swt.SWTUtils; //导入方法依赖的package包/类
Control createCompositeChart(final Composite parent, EventLogParser logParser,
String title) {
mChart = ChartFactory.createTimeSeriesChart(
null,
null /* timeAxisLabel */,
null /* valueAxisLabel */,
null, /* dataset. set below */
true /* legend */,
false /* tooltips */,
false /* urls */);
// get the font to make a proper title. We need to convert the swt font,
// into an awt font.
Font f = parent.getFont();
FontData[] fData = f.getFontData();
// event though on Mac OS there could be more than one fontData, we'll only use
// the first one.
FontData firstFontData = fData[0];
java.awt.Font awtFont = SWTUtils.toAwtFont(parent.getDisplay(),
firstFontData, true /* ensureSameSize */);
mChart.setTitle(new TextTitle(title, awtFont));
final XYPlot xyPlot = mChart.getXYPlot();
xyPlot.setRangeCrosshairVisible(true);
xyPlot.setRangeCrosshairLockedOnData(true);
xyPlot.setDomainCrosshairVisible(true);
xyPlot.setDomainCrosshairLockedOnData(true);
mChart.addChangeListener(new ChartChangeListener() {
@Override
public void chartChanged(ChartChangeEvent event) {
ChartChangeEventType type = event.getType();
if (type == ChartChangeEventType.GENERAL) {
// because the value we need (rangeCrosshair and domainCrosshair) are
// updated on the draw, but the notification happens before the draw,
// we process the click in a future runnable!
parent.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
processClick(xyPlot);
}
});
}
}
});
mChartComposite = new ChartComposite(parent, SWT.BORDER, mChart,
ChartComposite.DEFAULT_WIDTH,
ChartComposite.DEFAULT_HEIGHT,
ChartComposite.DEFAULT_MINIMUM_DRAW_WIDTH,
ChartComposite.DEFAULT_MINIMUM_DRAW_HEIGHT,
3000, // max draw width. We don't want it to zoom, so we put a big number
3000, // max draw height. We don't want it to zoom, so we put a big number
true, // off-screen buffer
true, // properties
true, // save
true, // print
true, // zoom
true); // tooltips
mChartComposite.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
mValueTypeDataSetMap.clear();
mDataSetCount = 0;
mOccurrenceDataSet = null;
mChart = null;
mChartComposite = null;
mValueDescriptorSeriesMap.clear();
mOcurrenceDescriptorSeriesMap.clear();
}
});
return mChartComposite;
}
示例3: getLabelFont
import org.jfree.experimental.swt.SWTUtils; //导入方法依赖的package包/类
/**
* Returns the current label font.
*
* @return The current label font.
*/
public java.awt.Font getLabelFont() {
return SWTUtils.toAwtFont(getDisplay(), this.labelFont, true);
}
示例4: getTickLabelFont
import org.jfree.experimental.swt.SWTUtils; //导入方法依赖的package包/类
/**
* Returns the current label font.
*
* @return The current label font.
*/
public java.awt.Font getTickLabelFont() {
return SWTUtils.toAwtFont(getDisplay(), tickLabelFont, true);
}
示例5: getTickLabelFont
import org.jfree.experimental.swt.SWTUtils; //导入方法依赖的package包/类
/**
* Returns the current label font.
*
* @return The current label font.
*/
public java.awt.Font getTickLabelFont() {
return SWTUtils.toAwtFont(getDisplay(), this.tickLabelFont, true);
}