- 博客(57)
- 收藏
- 关注
原创 ListView(ArrayAdapter)
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" andr
2020-10-31 23:37:43 69
原创 自动输入框AutoCompleteTextView
main.xml:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"
2020-10-31 19:13:39 587
原创 在界面布局文件中为控件绑定事件处理方法
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" andr
2020-10-31 15:26:50 188
原创 对一个比较器(按长度比较字符串)和监听器使用lambda表达式
package test;import javax.swing.*;import java.util.Arrays;import java.util.Date;public class LambdaTest { public static void main(String[] args) { var planets = new String[]{"1111", "22", "333", "3333", "4444", "55555"}; System.
2020-10-29 16:01:32 213
原创 打印一个类的全部信息
package test;import java.lang.reflect.Constructor;import java.lang.reflect.Field;import java.lang.reflect.Method;import java.lang.reflect.Modifier;import java.util.Scanner;public class ReflectionTest { public static void main(String[] args) {
2020-10-29 09:49:42 320
原创 创建、配置、启动、关闭和刷新activity
创建activity1、创建继承自Activity的Activity2、重写需要的回调方法3、设置要显示的视图配置在配置文件中添加 <activity android:name=".DetailActivity" android:label="详细"> </activity>启动入口Activity在xml文件中配置:在入口activity中添加一下内容<intent-
2020-10-27 20:09:02 395
原创 选项卡
选项卡组件不能直接添加到xml中。1、在布局文件中添加TabHost、TabWidget和TabContent组件前面两个组件都有相应的标签,而TabContent通常通过FrameLayout来实现。2、编写和标签页的xml布局文件3、在activity中获取并初始化TabHost组件4、为TabHost对象添加标签页main.xml:<?xml version="1.0" encoding="utf-8"?><TabHost xmlns:androi
2020-10-27 19:24:03 83
原创 滚动视图
在xml中添加滚动视图垂直方向上滚动<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/
2020-10-27 17:55:51 188
原创 实验六 多线程共享资源并发访问控制
#include<stdio.h>#include<sys/types.h>#include<unistd.h>//Linux/Unix系统中内置头文件,包含许多系统函数#include<stdlib.h>#include<pthread.h>#include<string.h>int num = 200, count = 30;void* sub1(void* arg){ for (int i = 0; i &l
2020-10-26 15:17:54 700
原创 Java基础语法
1、final1. 修饰变量:被他修饰的变量不可改变。一旦赋了初值,就不能被重新赋值。2. 修饰方法该方法不可被子类重写。但是可以被重载!3. 修饰类修饰的类不能被继承。比如:Math、String等。其中的方法自动成为final方法,而不包括字段。2、static1)static方法:在一个类中有个方法A,其他方法(比如B)想要调用A,那么就必须把A定义为static method2)static变量:如果想静态方法想要使用一个方法体外的成员变量(属于类的),那么这个成员变量就必须
2020-10-21 20:38:41 224
原创 下拉列表框
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" andr
2020-10-21 15:52:16 92
原创 网格视图
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" andr
2020-10-21 15:50:48 176
原创 图像切换器
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" an
2020-10-20 16:37:53 113
原创 实验5 结果不唯一的多线程并发运行实例
//// Created by macho-man on 2020/10/19.//#include <pthread.h>#include<stdio.h>void* printyou(void* unused){ int c=2000; while(c--) fputs("你",stderr); return NULL;}void* printme(void* unused){ int c=2000; w
2020-10-20 11:39:40 376
原创 实验四 Linux进程控制实验
#include<sys/wait.h>#include<sys/types.h>#include<stdio.h>#include<stdlib.h>#include<signal.h>int main(){ pid_t childpid; int status; int retval; childpid = fork();//返回一个进程号 if (-1 == childpid) { perror("fork()")
2020-10-19 21:15:58 1194
原创 实验二 Linux程序接口实验
#include<unistd.h>//Linux/Unix系统中内置头文件,包含许多系统函数#include<pwd.h>//口令文件#include<sys/types.h>//类型头文件,定义了基本的系统数据类型。#include<stdio.h>int main(int argc, char** argv){ pid_t my_pid, parent_pid;//进程号类型 uid_t my_uid, my_euid;//用户ID类型
2020-10-19 20:05:29 369
原创 图像视图
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" andr
2020-10-19 11:36:23 97
原创 星级评分条
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" an
2020-10-19 11:20:18 58
原创 subms项目
一、项目搭建1、搭建一个maven web项目配置pom.xml导入依赖:<dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <
2020-10-18 18:13:27 718
原创 JSP调用CSS,但是无法显示渲染后的页面
导致问题的可能原因:1、过滤器中设置了:response.setContentType("text/html;charset=utf-8");2、在JSP中<!DOCTYPE html>标签使用错误DOCTYPE html的作用
2020-10-18 10:59:34 431
原创 idea2020数据库连接异常
如果数据库连接出现异常,出现下面的错误:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure[08001] Could not create connection to database server.直接在idea右边的数据库模块中按一下步骤排查问题,直到测试连接成功:1、用户名和密码是是否正确2、url=jdbc:mysql://localhost:3306/smbms端口号
2020-10-16 11:01:35 578
原创 计时器
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" an
2020-10-14 16:56:46 59
原创 时间选择器
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" an
2020-10-14 16:43:49 107
原创 日期选择器
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" an
2020-10-14 16:36:33 61
原创 表格布局
<?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" andro
2020-10-14 10:22:17 98
原创 相对布局
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" an
2020-10-14 10:22:00 62
原创 线性布局
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" andr
2020-10-13 19:04:39 66
原创 网格布局
<?xml version="1.0" encoding="utf-8"?><GridLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" androi
2020-10-13 19:03:13 75
原创 帧布局
<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" andro
2020-10-13 19:01:03 83
原创 自定义组件(在屏幕上滑动)
package com.example.myview;import android.view.MotionEvent;import android.view.View;import android.widget.FrameLayout;import androidx.appcompat.app.AppCompatActivity;import android.os.Bundle;public class MainActivity extends AppCompatActivity {
2020-10-13 18:59:53 119
原创 Java代码实现布局
package com.example.javalayout;import android.content.DialogInterface;import android.graphics.Color;import android.util.Log;import android.util.TypedValue;import android.view.Gravity;import android.view.View;import android.view.ViewGroup;import an
2020-10-13 18:54:35 352
原创 按钮
package com.example.buttontest;import android.view.View;import android.widget.Button;import android.widget.Toast;import androidx.appcompat.app.AppCompatActivity;import android.os.Bundle;public class MainActivity extends AppCompatActivity { @Ov
2020-10-13 18:49:55 77
原创 单选框
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" andr
2020-10-13 18:47:46 179
原创 复选框
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" andr
2020-10-13 18:43:13 96
原创 过滤器实现权限拦截
Login.jsp<%@ page contentType="text/html;charset=UTF-8" language="java" %><html><head> <title>Title</title></head><body><form action="${pageContext.request.contextPath}/Login" method="get"> <.
2020-10-13 17:07:37 140
原创 监听器
package Listener;import javax.servlet.ServletContext;import javax.servlet.ServletContextEvent;import javax.servlet.ServletContextListener;import javax.servlet.annotation.WebListener;import javax.servlet.http.HttpSessionAttributeListener;import javax
2020-10-13 15:03:10 45
原创 2020-10-12
-编写filterpackage Filter;import javax.servlet.*;import javax.servlet.annotation.WebFilter;import java.io.IOException;@WebFilter(filterName = "CharacterEncodingFilter")public class CharacterEncodingFilter implements Filter { public void destroy(.
2020-10-12 22:32:26 77
原创 JavaBean/MVC
必须要有一个无参构造;属性必须私有化;必须有对应的set/get方法;一般用来和数据库的字段做映射 ORM;Model业务处理:业务逻辑(Service)数据持久层:CRUD(DAO)#####View展示数据提供链接发起servlet请求#####Controller(Servlet)接受用户的请求交给业务层处理对应的代码控制视图的跳转...
2020-10-12 21:19:06 71
原创 JDBC
添加依赖: <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.47</version> </dependency>import java.sql.*;pub...
2020-10-12 20:03:59 48
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人