本文整理汇总了Java中org.jfree.experimental.swt.SWTUtils类的典型用法代码示例。如果您正苦于以下问题:Java SWTUtils类的具体用法?Java SWTUtils怎么用?Java SWTUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SWTUtils类属于org.jfree.experimental.swt包,在下文中一共展示了SWTUtils类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTitleProperties
import org.jfree.experimental.swt.SWTUtils; //导入依赖的package包/类
/**
* Sets the properties of the specified title to match the properties
* defined on this panel.
*
* @param chart the chart whose title is to be modified.
*/
public void setTitleProperties(JFreeChart chart) {
if (this.showTitle) {
TextTitle title = chart.getTitle();
if (title == null) {
title = new TextTitle();
chart.setTitle(title);
}
title.setText(getTitleText());
title.setFont(SWTUtils.toAwtFont(getDisplay(), getTitleFont(),
true));
title.setPaint(SWTUtils.toAwtColor(getTitleColor()));
}
else {
chart.setTitle((TextTitle) null);
}
}
示例2: restoreAutoDomainBounds
import org.jfree.experimental.swt.SWTUtils; //导入依赖的package包/类
/**
* Restores the auto-range calculation on the domain axis.
*/
public void restoreAutoDomainBounds() {
Plot p = this.chart.getPlot();
if (p instanceof Zoomable)
{
Zoomable z = (Zoomable) p;
z.zoomDomainAxes(0.0, this.info.getPlotInfo(), SWTUtils.toAwtPoint(this.zoomPoint));
}
}
示例3: restoreAutoRangeBounds
import org.jfree.experimental.swt.SWTUtils; //导入依赖的package包/类
/**
* Restores the auto-range calculation on the range axis.
*/
public void restoreAutoRangeBounds() {
Plot p = this.chart.getPlot();
if (p instanceof ValueAxisPlot)
{
Zoomable z = (Zoomable) p;
z.zoomRangeAxes(0.0, this.info.getPlotInfo(), SWTUtils.toAwtPoint(this.zoomPoint));
}
}
示例4: updateChartProperties
import org.jfree.experimental.swt.SWTUtils; //导入依赖的package包/类
/**
* Updates the chart.
*
* @param chart the chart.
*/
public void updateChartProperties(JFreeChart chart) {
chart.setAntiAlias(this.antialias.getSelection());
chart.setBackgroundPaint(SWTUtils.toAwtColor(
this.backgroundPaintCanvas.getColor()));
}
示例5: restoreAutoDomainBounds
import org.jfree.experimental.swt.SWTUtils; //导入依赖的package包/类
/**
* Restores the auto-range calculation on the domain axis.
*/
public void restoreAutoDomainBounds() {
Plot p = this.chart.getPlot();
if (p instanceof Zoomable) {
Zoomable z = (Zoomable) p;
// we need to guard against this.zoomPoint being null
org.eclipse.swt.graphics.Point zp =
(this.zoomPoint != null ? this.zoomPoint
: new org.eclipse.swt.graphics.Point(0, 0));
z.zoomDomainAxes(0.0, this.info.getPlotInfo(),
SWTUtils.toAwtPoint(zp));
}
}
示例6: restoreAutoRangeBounds
import org.jfree.experimental.swt.SWTUtils; //导入依赖的package包/类
/**
* Restores the auto-range calculation on the range axis.
*/
public void restoreAutoRangeBounds() {
Plot p = this.chart.getPlot();
if (p instanceof ValueAxisPlot) {
Zoomable z = (Zoomable) p;
// we need to guard against this.zoomPoint being null
org.eclipse.swt.graphics.Point zp =
(this.zoomPoint != null ? this.zoomPoint
: new org.eclipse.swt.graphics.Point(0, 0));
z.zoomRangeAxes(0.0, this.info.getPlotInfo(),
SWTUtils.toAwtPoint(zp));
}
}
示例7: SWTOtherEditor
import org.jfree.experimental.swt.SWTUtils; //导入依赖的package包/类
/**
* Creates a new instance.
*
* @param parent the parent.
* @param style the style.
* @param chart the chart.
*/
public SWTOtherEditor(Composite parent, int style, JFreeChart chart)
{
super(parent, style);
FillLayout layout = new FillLayout();
layout.marginHeight = layout.marginWidth = 4;
setLayout(layout);
Group general = new Group(this, SWT.NONE);
general.setLayout(new GridLayout(3, false));
general.setText(localizationResources.getString("General"));
// row 1: antialiasing
antialias = new Button(general, SWT.CHECK);
antialias.setText(localizationResources.getString("Draw_anti-aliased"));
antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false,
3, 1));
antialias.setSelection(chart.getAntiAlias());
//row 2: background paint for the chart
new Label(general, SWT.NONE).setText(localizationResources.getString(
"Background_paint"));
backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
bgGridData.heightHint = 20;
backgroundPaintCanvas.setLayoutData(bgGridData);
Button selectBgPaint = new Button(general, SWT.PUSH);
selectBgPaint.setText(localizationResources.getString("Select..."));
selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
false));
selectBgPaint.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
ColorDialog dlg = new ColorDialog(getShell());
dlg.setText(localizationResources.getString(
"Background_paint"));
dlg.setRGB(backgroundPaintCanvas.getColor().getRGB());
RGB rgb = dlg.open();
if (rgb != null) {
backgroundPaintCanvas.setColor(
new Color(getDisplay(), rgb));
}
}
}
);
}
示例8: SWTOtherEditor
import org.jfree.experimental.swt.SWTUtils; //导入依赖的package包/类
/**
* Creates a new instance.
*
* @param parent the parent.
* @param style the style.
* @param chart the chart.
*/
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
super(parent, style);
FillLayout layout = new FillLayout();
layout.marginHeight = layout.marginWidth = 4;
setLayout(layout);
Group general = new Group(this, SWT.NONE);
general.setLayout(new GridLayout(3, false));
general.setText(localizationResources.getString("General"));
// row 1: antialiasing
this.antialias = new Button(general, SWT.CHECK);
this.antialias.setText(localizationResources.getString(
"Draw_anti-aliased"));
this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
false, 3, 1));
this.antialias.setSelection(chart.getAntiAlias());
//row 2: background paint for the chart
new Label(general, SWT.NONE).setText(localizationResources.getString(
"Background_paint"));
this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
bgGridData.heightHint = 20;
this.backgroundPaintCanvas.setLayoutData(bgGridData);
Button selectBgPaint = new Button(general, SWT.PUSH);
selectBgPaint.setText(localizationResources.getString("Select..."));
selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
false));
selectBgPaint.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
ColorDialog dlg = new ColorDialog(getShell());
dlg.setText(localizationResources.getString(
"Background_paint"));
dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
.getColor().getRGB());
RGB rgb = dlg.open();
if (rgb != null) {
SWTOtherEditor.this.backgroundPaintCanvas.setColor(
new Color(getDisplay(), rgb));
}
}
}
);
}
示例9: updateChartProperties
import org.jfree.experimental.swt.SWTUtils; //导入依赖的package包/类
/**
* Updates the chart.
*
* @param chart the chart.
*/
public void updateChartProperties(JFreeChart chart) {
chart.setAntiAlias(this.antialias.getSelection());
chart.setBackgroundPaint(SWTUtils.toAwtColor(
this.backgroundPaintCanvas.getColor()));
}
示例10: 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));
}
示例11: 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;
}