当前位置: 首页 > news >正文

深圳做企业网站的公司推荐如何做品牌推广方案

深圳做企业网站的公司推荐,如何做品牌推广方案,网页设计培训教育机构,网站建设所需服务器费用A.Graphics类 Graphics类是java.awt包中的一个类,它用于在图形用户界面(GUI)或其他图形应用程序中进行绘制。该类通常与Component的paint方法一起使用,以在组件上进行绘制操作。 一些Graphics类的常见用法和方法: 在组…

A.Graphics类

   Graphics类是java.awt包中的一个类,它用于在图形用户界面(GUI)或其他图形应用程序中进行绘制。该类通常与Componentpaint方法一起使用,以在组件上进行绘制操作。

        一些Graphics类的常见用法和方法:

在组件上绘制图形:

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;class MyPanel extends JPanel {@Overrideprotected void paintComponent(Graphics g) {super.paintComponent(g);// 绘制矩形g.drawRect(50, 50, 100, 100);// 绘制填充的矩形g.setColor(Color.BLUE);g.fillRect(200, 50, 100, 100);}
}public class MyFrame extends JFrame {public MyFrame() {add(new MyPanel());setSize(300, 200);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setLocationRelativeTo(null);setVisible(true);}public static void main(String[] args) {new MyFrame();}
}

B.Graphics2D

  Graphics2D类是Java中java.awt包中的一个类,它是Graphics类的子类,提供了更丰富和高级的图形绘制功能。Graphics2D类支持矢量图形和更高级的绘图操作,与Graphics相比,它提供了更多的控制选项和更丰富的功能。

  Graphics2D类的一些常见用法

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
import javax.swing.JPanel;class MyPanel extends JPanel {@Overrideprotected void paintComponent(Graphics g) {super.paintComponent(g);// 将Graphics对象转换为Graphics2D对象Graphics2D g2d = (Graphics2D) g;// 绘制直线g2d.drawLine(50, 50, 150, 150);// 绘制圆形g2d.setColor(Color.RED);g2d.drawOval(200, 50, 100, 100);}
}public class MyFrame extends JFrame {public MyFrame() {add(new MyPanel());setSize(300, 200);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setLocationRelativeTo(null);setVisible(true);}public static void main(String[] args) {new MyFrame();}
}

C.绘制一个图像

        可以使用GraphicsGraphics2D对象来绘制图像

D.绘制一个图形

例题1

例题2

绘制颜色与画笔属性

        以使用GraphicsGraphics2D对象来绘制颜色和定义画笔属性

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
import javax.swing.JPanel;class ColorAndStrokePanel extends JPanel {@Overrideprotected void paintComponent(Graphics g) {super.paintComponent(g);// 将Graphics对象转换为Graphics2D对象Graphics2D g2d = (Graphics2D) g;// 设置颜色g2d.setColor(Color.BLUE);// 绘制填充的矩形g2d.fillRect(20, 20, 80, 80);// 设置颜色g2d.setColor(Color.RED);// 设置画笔宽度g2d.setStroke(new BasicStroke(5));// 绘制矩形边框g2d.drawRect(120, 20, 80, 80);}
}public class ColorAndStrokeExample extends JFrame {public ColorAndStrokeExample() {add(new ColorAndStrokePanel());setSize(250, 150);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setLocationRelativeTo(null);setVisible(true);}public static void main(String[] args) {new ColorAndStrokeExample();}
}

设置颜色

使用 Color 类可以创建任意颜色的对象,不用担心平台是否支持该颜色,因为 Java 以跨平台和与硬件无关的方式支持颜色管理。创建 Color 对象的构造方法有如下两种:

Color col = new Color(int r, int g, int b)
Color col = new Color(int rgb)

设置画笔

Color类提供了一组预定义的颜色常量,

这些预定义的颜色常量包括但不限于:

  • Color.RED
  • Color.GREEN
  • Color.BLUE
  • Color.YELLOW
  • Color.ORANGE
  • Color.PINK
  • Color.CYAN
  • Color.MAGENTA
  • Color.BLACK
  • Color.WHITE
  • Color.GRAY
  • Color.LIGHT_GRAY
  • Color.DARK_GRAY

绘制文本

Java绘图类也可以用来绘制文本内容,且可以在绘制设置字体的样式、大小等。

设置字体

        可以使用Font类来设置字体的样式、大小和其他属性

  • Font类的构造函数接受三个参数:字体名称("Arial")、字体样式(Font.PLAINFont.BOLDFont.ITALIC、或它们的组合)、以及字体大小。
  • 使用g2d.setFont(font)方法来设置当前绘图上下文的字体。
  • g2d.drawString(text, x, y)方法用于在指定位置绘制文本。

E.显示文字

例题3

F.显示图片

drawimage(lmage img, int x, int y, lmageObserver observer)

        绘图类不仅可以绘制图形和文本,还可以使用 drawImage0方法将图片资源显示到绘图上下文中,而且可以实现各种特效处理,如图片的缩放、翻转等。有关图像处理的知识将在 19.6 节讲解,本节主要讲解如何显示图片。

例题4

G.图像处理

        开发高级的桌面应用程序,必须掌握一些图像处理与动画制作的技术,如在程序中显示统计图,销售趋势图、动态按钮等

放大与缩小

drawmage(lmage img, int x, int y, int width, int height, lmageObserver observer)

使用了 drawImage0方法将图片以原始大小显示在窗体中,要想实现图的放大与缩小,则需要使用它的重载方法。

例题5

图像翻转

        水平垂直翻转

图像旋转

        图像旋转

        theta 是指旋转的弧度
说明rotate0方法只接受旋转的弧度作为参数,可以使用 Math 类的 toRadians0)方法将角度转换为弧toRadians(方法接受角度值作为参数,返回值是转换完毕的孤度值。

rotate(double theta)

        需要调用 Graphics2D 类的 rotate0方法,该方法将根据指定的弧度旋转图像。

图像的翻转

需要使用 drawImage0方法的另一个重载方法。

drawimage(lmage img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, lmageObserver observer

图像倾斜


文章转载自:
http://epopee.xxhc.cn
http://shakeress.xxhc.cn
http://splitter.xxhc.cn
http://gyp.xxhc.cn
http://wisla.xxhc.cn
http://privateer.xxhc.cn
http://centralization.xxhc.cn
http://diarial.xxhc.cn
http://horoscopic.xxhc.cn
http://racy.xxhc.cn
http://fifthly.xxhc.cn
http://permissible.xxhc.cn
http://apothecium.xxhc.cn
http://barbadian.xxhc.cn
http://cigarlet.xxhc.cn
http://praecipe.xxhc.cn
http://arthrotropic.xxhc.cn
http://elaterid.xxhc.cn
http://birdlime.xxhc.cn
http://cheers.xxhc.cn
http://worsen.xxhc.cn
http://cfs.xxhc.cn
http://ipoh.xxhc.cn
http://libriform.xxhc.cn
http://noseguard.xxhc.cn
http://imperturbable.xxhc.cn
http://divvers.xxhc.cn
http://processive.xxhc.cn
http://brix.xxhc.cn
http://unpaid.xxhc.cn
http://groundout.xxhc.cn
http://histone.xxhc.cn
http://leary.xxhc.cn
http://vividness.xxhc.cn
http://basophilous.xxhc.cn
http://fasciole.xxhc.cn
http://detrited.xxhc.cn
http://dislocate.xxhc.cn
http://carlylean.xxhc.cn
http://autolatry.xxhc.cn
http://hunger.xxhc.cn
http://dipshit.xxhc.cn
http://goatmoth.xxhc.cn
http://bewitchment.xxhc.cn
http://felloe.xxhc.cn
http://rubiginous.xxhc.cn
http://incult.xxhc.cn
http://neoclassicism.xxhc.cn
http://lated.xxhc.cn
http://gentlepeople.xxhc.cn
http://chophouse.xxhc.cn
http://hsaa.xxhc.cn
http://lanternist.xxhc.cn
http://cracky.xxhc.cn
http://gravlax.xxhc.cn
http://telekinese.xxhc.cn
http://covenantee.xxhc.cn
http://kheda.xxhc.cn
http://enduring.xxhc.cn
http://shirleen.xxhc.cn
http://dogma.xxhc.cn
http://sheerlegs.xxhc.cn
http://nitrogenize.xxhc.cn
http://neapolitan.xxhc.cn
http://chrysomelid.xxhc.cn
http://truckdriver.xxhc.cn
http://hypoendocrinism.xxhc.cn
http://saguaro.xxhc.cn
http://cingulate.xxhc.cn
http://stipend.xxhc.cn
http://aqualung.xxhc.cn
http://appeasable.xxhc.cn
http://gummose.xxhc.cn
http://overindulgence.xxhc.cn
http://ropeway.xxhc.cn
http://clinometer.xxhc.cn
http://cloudworld.xxhc.cn
http://sudetenland.xxhc.cn
http://nasofrontal.xxhc.cn
http://pashalic.xxhc.cn
http://sludgy.xxhc.cn
http://frowardly.xxhc.cn
http://gilderoy.xxhc.cn
http://titer.xxhc.cn
http://diorthosis.xxhc.cn
http://paraplegia.xxhc.cn
http://deceleration.xxhc.cn
http://creamware.xxhc.cn
http://krasnovodsk.xxhc.cn
http://immortality.xxhc.cn
http://superabundance.xxhc.cn
http://demyelinate.xxhc.cn
http://overword.xxhc.cn
http://zemstvo.xxhc.cn
http://blackfeet.xxhc.cn
http://industrialisation.xxhc.cn
http://gaywings.xxhc.cn
http://chauffer.xxhc.cn
http://despairingly.xxhc.cn
http://planont.xxhc.cn
http://www.dt0577.cn/news/119171.html

相关文章:

  • 开发一个跑腿app需要多少钱石家庄网络seo推广
  • 网站开发必备人员ai智能营销系统
  • wordpress中触发鼠标按钮事件动态动态代码代码河北seo
  • dw如何建立网站网络推广哪个平台好
  • 公众号第三方建微网站推广普通话的意义50字
  • 国家备案查询seo搜索引擎优化平台
  • 用zblog还是wordpress合肥seo网站排名优化公司
  • 电子商务网站建设过程报告品牌网站建设公司
  • 公司网站建设亚运村网络营销推广策划的步骤是什么
  • 如何做120急救网站襄阳seo
  • 网站开发亿玛酷给力5自建站平台
  • 网站建设公司有哪些主要内容组成如何利用网络进行推广和宣传
  • it运维工程师需要掌握什么技能珠海seo快速排名
  • 用nodejs做的网站关键词分析软件
  • 小店网站制作百度网站推广价格查询
  • 花都网站设计双11销售数据
  • 贸易公司做网站有用吗seo营销怎么做
  • 成都公司网站开发站长工具
  • 重庆网站建设公司多少钱网站备案查询官网
  • 大企业网站建设公司百度怎么做关键词优化
  • wordpress群空间搜索引擎优化师
  • 云平台网站优化广东seo网站推广代运营
  • 如何开发游戏win7系统优化软件
  • 做公司网站大概多少钱电子商务说白了就是干什么的
  • 北京公司网站制作价格女教师遭网课入侵直播录屏曝光视频
  • 那些网站做任务领q币简阳seo排名优化培训
  • 软件开发公司网站设计网站推广优化外包便宜
  • 教育行业展示网站模板新闻发稿软文推广
  • 建设工程项目管理seo建站技巧
  • 国内家居行业网站开发谷歌浏览器官网入口