微信小程序 云数据库 一次性插入多条记录?

微信小程序 云数据库 一次性插入多条记录?,第1张

db.collection().add({ data:[ objcet1, object2 ] })

官方文档data的值是个Object类型,数组也是Object类型,这样执行的结果是object1和objec2会分别添加为两条记录.

import javax.swing.JPanel

import javax.swing.JFrame

import javax.swing.JButton

import javax.swing.JTextField

import java.awt.FlowLayout

import java.awt.event.ActionEvent

import java.awt.event.ActionListener

import java.awt.event.WindowAdapter

import java.awt.event.WindowEvent

public class Test extends JFrame implements ActionListener{

private static final long serialVersionUID = 1L

private JPanel jPanel

private JButton jButton1,jButton2,jButton3

private JTextField tf1

public Test(String title) {

super(title)

init()

}

private void init() {

jPanel=new JPanel()

jPanel.setLayout(new FlowLayout())

tf1=new JTextField(20)

jButton1=new JButton("按钮1")

jButton2=new JButton("按钮2")

jButton3=new JButton("按钮3")

jButton1.addActionListener(this)

jButton2.addActionListener(this)

jButton3.addActionListener(this)

jPanel.add(tf1)

jPanel.add(jButton1)

jPanel.add(jButton2)

jPanel.add(jButton3)

this.add(jPanel)

this.setSize(300,100)

this.setResizable(false)

this.setVisible(true)

this.addWindowListener(new WindowAdapter() {

public void windowClosing(final WindowEvent e) {

System.exit(0)

}

})

}

public void actionPerformed(ActionEvent e) {

if(e.getSource().equals(jButton1)){

tf1.setText("按钮1")

}

if(e.getSource().equals(jButton2)){

tf1.setText("按钮2")

}

if(e.getSource().equals(jButton3)){

tf1.setText("按钮3")

}

}

public static void main(String[] args){

new Test("文字变换")

}

}

public class Hello extends Applet implements MouseListener{

public void init(){

addMouseListener(this)

}

public void mouseEntered(MouseEvent e){

au.play()

setBackground(Color.blue)

}

public void mouseExited(MouseEvent e){

setBackground(Color.black)

}

public void mousePressed(MouseEvent e){}

public void mouseReleased(MouseEvent e){}

public void mouseClicked(MouseEvent e){}

}

首先在小程序中实现事件监听器,再实现鼠标用户接口

如何小程序中处理鼠标双、三击?

component.addMouseListener(

new MyMouseListener())

public class MyMouseListener extends MouseAdapter {

public void mouseClicked(MouseEvent evt) {

if (evt.getClickCount() == 3) {

// 处理鼠标三击

} else if (evt.getClickCount() == 2) {

// 处理鼠标双击

}

}

}

处理鼠标右键

public mouseClicked(MouseEvent e){

if(e.isMetaDown()){//检测鼠标右键单击

}

如何在小程序中处理鼠标中间键?

new MyMouseListener())

public class MyMouseListener extends MouseAdapter {

public void mouseClicked(MouseEvent evt) {

if ((evt.getModifiers() &?

InputEvent.BUTTON1_MASK) != 0) {

processLeft(evt.getPoint())

//处理鼠标左键单击

}

if ((evt.getModifiers() &?

InputEvent.BUTTON2_MASK) != 0) {

processMiddle(evt.getPoint())

//处理鼠标中间键单击

}

if ((evt.getModifiers() &?

InputEvent.BUTTON3_MASK) != 0) {

processRight(evt.getPoint())

//处理鼠标右键单击

}

}

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/11527383.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存